简体   繁体   English

简单的jQuery对话框无法创建输入

[英]simple jquery dialog box can't create input

may any one help me create a input box inside my dialog box? 谁能帮我在对话框中创建一个输入框? i am using the jquery-ui.js. 我正在使用jquery-ui.js。 this is my code: 这是我的代码:

 $(document).on("click",".savebtn",function().        {
        var id = $(this).attr("id");

            $.dialog({
                title: "Activation date ",
                  content:"Activation date ",                                    
               create: function() {
                  $("#inputBox").val();
                },
                  closeBack:function(){
                    $.dialog.message({
                      content: "The id is "+ id
                    });
                  },
                  buttons:[
                    {
                      text:"Click me"
                    }
                  ]
            });
    });

You can try this: 您可以尝试以下方法:

Fiddle 小提琴

HTML: HTML:

<div id='dialog' style='display: none;'>
  <input type="text" />
</div>

<button>
  Click Me!
</button>

Jquery: jQuery:

$(document).ready(function() {
  $("button").click(function() {
    $("#dialog").dialog({
      resizable: false,
      modal: true,
      title: "My Awesome Title",
      buttons: {
        "Do Something": function() {
          alert("Do something if I was clicked.");
        },
        Cancel: function() {
          alert("Dialog Canceled");
          $(this).dialog("close");
        }
      }
    });
  });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM