trinidado
trinidado

Reputation: 31

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. 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"
                    }
                  ]
            });
    });

Upvotes: 0

Views: 766

Answers (1)

dokgu
dokgu

Reputation: 6070

You can try this:

Fiddle

HTML:

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

<button>
  Click Me!
</button>

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");
        }
      }
    });
  });
});

Upvotes: 1

Related Questions