文本框在Jquery模式对话框下丢失值

时间:2016-02-03 10:56:01

标签: javascript c# jquery asp.net

我正在使用下面的脚本进行模态对话框。我在对话框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 

1 个答案:

答案 0 :(得分:0)

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

  //    $("#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) {

                     }

                 });