<script type="text/javascript">
$(document).ready(function() {
$("#popup_div").dialog({
autoOpen: false
});
$("#btn_click").click(function() {
$("#popup_div").dialog("open");
//$("#popup_div").toggle("100", $("#popup_div").dialog("close"));
});
});
</script>
I wrote a function which will display the data in popup and immediately the popup will close. I need that popup stays sometime after clicking close button it will close.
<script type="text/javascript">
$(document).ready(function() {
$("#popup_div").dialog({
autoOpen: false
});
$("#btn_click").click(function() {
$("#popup_div").dialog("open");
//$("#popup_div").toggle("100", $("#popup_div").dialog("close"));
});
});
</script>
I wrote a function which will display the data in popup and immediately the popup will close. I need that popup stays sometime after clicking close button it will close.
Share Improve this question edited Aug 18, 2014 at 5:44 Mathias 5,6702 gold badges33 silver badges47 bronze badges asked Aug 18, 2014 at 5:24 user3887236user3887236 1011 gold badge1 silver badge5 bronze badges 1- can you make fiddle of the same ??? – ankur140290 Commented Aug 18, 2014 at 6:06
2 Answers
Reset to default 3Try this,
$("#btn_click").click(function () {
$("#popup_div").dialog("open");
});
// code to close the dialog, let btnClose is the Id of button in popup_div
$("#popup_div").on('click','#btnClose',function(){
$("#popup_div").dialog("close");
});
Demo
If you want the dialog to delay before closing then set a timeout:
$("#popup_div").on('click', '#btnClose', function () {
setTimeout(function() {
$("#popup_div").dialog("close");
}, 1000);
});
JSFiddle example:
http://jsfiddle/606pgg4o/1/