按钮单击“我的jQuery”对话框中的“不工作”

按钮单击“我的jQuery”对话框中的“不工作”,jquery,Jquery,您好,我有一个jQuery对话框,它在页面加载时运行,我想实现这样一个功能:只有在选中“条款和条件”复选框时,jQuery对话框才会关闭,但按钮单击事件不起作用 $("<div title='E-Certificate'><h2 style = 'color:black'><b>Electronic Certificate of Origin</b></h2><p align = 'right' >،،، الاعضاء ا

您好,我有一个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();
$("电子原产地证书电子原产地证书电子原产地证书

根据迪拜智能政府倡议,作为迪拜商会帮助会员轻松开展业务的努力的一部分,请注意,发票和装箱单将从系统中自动加盖印章,以取代现有的标签。

这将从18日起强制执行ov 2017。

感谢您的合作。

،،،،


有关更多详细信息,请阅读并同意条款和条件以及隐私政策。dialog();

这是小提琴:-

在JuerUI创建者上添加按钮,如下所示:

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

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

$(“电子原产地证书电子原产地证书电子原产地证书

根据迪拜智能政府倡议,作为迪拜商会帮助会员轻松开展业务的努力的一部分,请注意,发票和装箱单将从系统中自动加盖印章,以取代现有的标签。

这将从18日起强制执行ov 2017。

感谢您的合作。

،،،


有关更多详细信息,请
我已阅读并同意条款和条件以及隐私政策\n

以下是上述问题的答案:-您被阻止放置小提琴链接的原因之一-代码应放置在任务中ion。如果JSFIDLE出现问题,您的问题将无法回答。您还应该展示您为解决问题所做的努力。小提琴本身只是显示对话框。您尝试在哪里“关闭对话框”?只需添加文本“关闭”如果按钮无法完成此操作,您必须编写代码。我使用了表单标签和我放置代码的位置,如果选中此框,则不会显示警报,如果未选中,则会弹出警报,但这也不起作用。请使用
编辑
按钮向问题添加代码。注释中的代码不可读。但在此之前,单击s如果工作正常,您可以看到fiddle没有任何写在表单标记中的js代码在运行,无论是if条件还是else。您调用“onclick='Akash();”,但函数声明在哪里?该函数包含一条警报消息,仅用于检查其是否工作,但也不调用该函数。函数包含一条警报消息,仅用于检查其是否调用函数,但不调用。我甚至尝试了onclick=“window.open()”。但这也不起作用。请尝试像jQueryUIdoc中那样使用声明onclick:$(“#对话框消息”)。对话框({modal:true,按钮:{Ok:function(){$(this.dialog(“close”);}});
$("#dialog").dialog({
  autoOpen: false,
  height: 300,
  width: 350,
  resizable: false,
  autoOpen: false,
  modal: true,
  buttons: {
    'Ok' : function() {
      $("#dialog-form").dialog( "close" );  
    } 
  }
});
$("<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 !!")
            }
    });