$(function () { $('#testButton1').click(function () { var d = $("<div />") .css({ width: 200, height: 200 }) .html("Testing dialog <input type='text' id='idd' >").dialog({ modal: true, width: 200, height: 100, autoOpen: false, buttons: { "Ok": function () { }, "Cancel": function () { $(this).dialog("close"); } }, open: function () { $('#idd').attr("title", "Title goes here"); } }); d.dialog("open"); }); });