Reputation: 3
I Want to Close window.dialog
. I open window as below,
window.$('<div align="center" style="width:100%;height:100%;"><iframe src="'+fdt+'" width="100%" height="100%" frameborder="0" scrolling="no"></iframe></div>').dialog({
modal: true,
width: 460,
height: 450,
title: "Serial"
});
After open dialog, when press enter key on input I want to close this window. Please Help me.
$(document).ready(function(){
$('#stsr').keypress(function(e) {
if(e.keyCode==13){
//I Want to close this window
}
});
});
Upvotes: 0
Views: 114
Reputation: 780723
Give the DIV an ID
window.$('<div id="dialog" align="center" style="width:100%;height:100%;"><iframe src="'+fdt+'" width="100%" height="100%" frameborder="0" scrolling="no"></iframe></div>').dialog({
modal: true,
width: 460,
height: 450,
title: "Serial"
});
Then you can refer to it later:
$(document).ready(function(){
$('#stsr').keypress(function(e) {
if(e.keyCode==13){
$("#dialog", window.parent.document).dialog("close");
}
});
});
Upvotes: 1