2017-10-31 16 views
-2

私はページのロード時に実行されるjQueryダイアログボックスを持っていますが、jQueryダイアログは、利用規約のチェックボックスにチェックが入っているがボタンクリックイベント働いていない。ここjQueryダイアログでボタンのクリックが機能しない

$("<div title='E-Certificate'><h2 style = 'color:black'><b>Electronic Certificate of Origin</b></h2><p align = 'right' >،،، الاعضاء الكرام</p><p align = 'right'>تماشيا مع مبادرات الحكومة الذكية ومن ضمن جهود غرفة دبي لتسهيل الأعمال، يرجى العلم بأنه سيتم توثيق الفواتير </p><p align = 'right'>وبيانات التعبئة الخاصة بشهادة المنشأ تلقائيا من خلال النظام وذلك عوضا عن استخدام الملصق الحالي.</p><p align = 'right'>وسوف تكون الخدمة الزامية ابتداء من 18 نوفمبر 2017</p><p align = 'right'>،،، شاكرين لكم حسن تعاونكم</p><p align = 'left'>Dear Member,</p><p align = 'left'>In line with Dubai Smart Government initiative and as part of Dubai Chamber’s efforts to help members do business with ease, please be noted that invoices and packing list will be stamped automatically from the systems replacing the existing stickers.</p><p align = 'left'>Which will be mandatory from 18th Nov 2017.</p><p align='left'>Thanks for your cooperation.</p><p align='left'>،،،</p><br>For more details, please <a href = 'htmltemplates/DC%20Electronic%20COO%20User%20Guide.pdf' target='_blank' style = 'color:blue'>click here</a><form action='#' onsubmit='if(document.getElementById('agree').checked) { return true; } else { alert('Please indicate that you have read and agree to the Terms and Conditions and Privacy Policy'); return false; }'><input type='checkbox' name='checkbox' value='check' id='agree' /> I have read and agree to the Terms and Conditions and Privacy Policy\n<p></p><input type='submit' name='submit' value='CLose' style = 'background-color: #10304c;border: none;color: white;padding: 5px 5px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px; margin: 4px 2px;cursor: pointer;border-radius:2px; '/></form></div>").dialog(); 

はフィドルです: - :

$("#dialog").dialog({ 
    modal: true, 
    buttons: { 
    Ok: function() { 

     if ("checkbox.checked") $(this).dialog("close"); 
    } 
    } 
}); 
+0

ここでは、上記質問のためのフィドルです:-http:// jsfid dle.net/9z2ag/475/ – Aksa

+0

リンクをフィドルに置くことができなかった理由があります。コードは質問***に入れるべきです。 jsFiddleがダウンした場合、あなたの質問は答えられません。また、問題を解決するためにどのような努力をしたかを示す必要があります。フィーリング自体はダイアログを表示しているだけです。 –

+0

ダイアログを閉じるにはどうしますか?ボタンにテキスト「閉じる」を追加するだけでこれを達成することはできません。そのためにコードを記述する必要があります。 – David

答えて

0

は、このようなjueryui-クリエーターの上にボタンを追加します。

+0

しかし、そのクリックがうまくいく前に、フォームタグ内に書かれているjsコードのどれもが動作していないことがわかります。 – Aksa

+0

あなたは "onclick = 'Akash();"と呼びますが、関数の宣言はどこですか? – Bergi

+0

この機能には、機能するかどうかをチェックするアラートメッセージが含まれていますが、その機能も呼び出されていません。 – Aksa

0
$("#dialog").dialog({ 
    autoOpen: false, 
    height: 300, 
    width: 350, 
    resizable: false, 
    autoOpen: false, 
    modal: true, 
    buttons: { 
    'Ok' : function() { 
     $("#dialog-form").dialog("close"); 
    } 
    } 
}); 
+0

これは質問への答えを提供しません。十分な[評判](https://stackoverflow.com/help/whats-reputation)があれば、[投稿にコメントする]ことができます(https://stackoverflow.com/help/privileges/comment)。代わりに、[質問者からの明確化を必要としない回答を提供する](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an- i-do-代わりに)。 - [レビューから](/レビュー/低品質の投稿/ 17793631) –

0
$("<div title='E-Certificate'><h2 style = 'color:black'><b>Electronic Certificate of Origin</b></h2><p align = 'right' >،،، الاعضاء الكرام</p><p align = 'right'>تماشيا مع مبادرات الحكومة الذكية ومن ضمن جهود غرفة دبي لتسهيل الأعمال، يرجى العلم بأنه سيتم توثيق الفواتير </p><p align = 'right'>وبيانات التعبئة الخاصة بشهادة المنشأ تلقائيا من خلال النظام وذلك عوضا عن استخدام الملصق الحالي.</p><p align = 'right'>وسوف تكون الخدمة الزامية ابتداء من 18 نوفمبر 2017</p><p align = 'right'>،،، شاكرين لكم حسن تعاونكم</p><p align = 'left'>Dear Member,</p><p align = 'left'>In line with Dubai Smart Government initiative and as part of Dubai Chamber’s efforts to help members do business with ease, please be noted that invoices and packing list will be stamped automatically from the systems replacing the existing stickers.</p><p align = 'left'>Which will be mandatory from 18th Nov 2017.</p><p align='left'>Thanks for your cooperation.</p><p align='left'>،،،</p><br>For more details, please <a href = 'htmltemplates/DC%20Electronic%20COO%20User%20Guide.pdf' target='_blank' style = 'color:blue'>click here</a><br><input type='checkbox' name='checkbox' value='check' id='agree' /> I have read and agree to the Terms and Conditions and Privacy Policy\n<p></p><div id = 'openCandy'><input type='button' name='submit' value='Close' style = 'background-color: #10304c;border: none;color: white;padding: 5px 5px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px; margin: 4px 2px;cursor: pointer;border-radius:2px; '/></div></form</div>").dialog(); 



$('#openCandy').click(function() { 
      if ($('input[name="checkbox"]').is(':checked')) { 
      $(this).closest('.ui-dialog-content').dialog('close'); 
      } 
      else { 
      swal('Accept the terms and conditions.'); 
      //alert ("Please accept the terms and conditions !!") 
      } 
    }); 

これは私のコードであり、それは私のために働いたhttp://jsfiddle.net/9z2ag/475/

関連する問題