“Jquery 模式”对话框下的“文本框丢失值”

本文关键字:文本 Jquery 模式 对话框 | 更新日期: 2023-09-27 18:33:11

我正在将下面的脚本用于模态对话框。我在对话框div 下有一个文本框和一个按钮,但是当我单击按钮文本框值时仍然为空,为什么?任何人都可以帮忙吗

  //Everything is working fine but textboxes are losing their values on button click

 $("#dialog").dialog({ modal: true });
         $("#dialog").dialog({ resizable: false });
         $("#dialog").dialog({
             buttons: {
                 //'Confirm': function () {
                 //    $("[id*=btn_Confirm_View]").click();
                 //},
                 'Cancel': function () {
                     $(this).dialog('close');
                 }
             }
         });
         $("#dialog").dialog({ draggable: false });
         $("#dialog").dialog({ closeOnEscape: false });
         $("#dialog").dialog({
             width: 'auto',
             autoOpen: false,
             show: {
                 effect: "blind",
                 duration: 1500
             },
             hide: {
                 effect: "scale",
                 duration: 300
             }
         });
         $("#dialog").dialog({
             close: function (event, ui) {
             }
         });
  //Everything is working fine but textboxes are losing their values on button 

“Jquery 模式”对话框下的“文本框丢失值”

我得到了解决方案... :)这是我修改后的代码...

  //    $("#dialog").dialog({ modal: true });
                 $("#dialog").dialog({ resizable: false });
                 $("#dialog").dialog({
                     buttons: {
                         //'Confirm': function () {
                         //    $("[id*=btn_Confirm_View]").click();
                         //},
                         'Cancel': function () {
                             $(this).dialog('close');
                         }
                     }
                 });
                 $("#dialog").dialog({ draggable: false });
                 $("#dialog").dialog({ closeOnEscape: false });
                 $("#dialog").dialog({
                     width: 'auto',
                     autoOpen: false,
                     show: {
                         effect: "blind",
                         duration: 1500
                     },
                     hide: {
                         effect: "scale",
                         duration: 300
                     }
                 });
//I Added these two lines and now they are working fine
                 $("#dialog").parent().appendTo(jQuery("form:first"));
                 $("#dialog").dialog({
                     close: function (event, ui) {
                     }
                 });