Focus element inside iframe when iframe attached to Jquery Dialog
- by huzzy143
Hi,
I have a iFrame which i load into jquery dialog.
I want to focus an element inside the iFrame whenever the Jquery Dialog is being opened.
Here is the code i am using to attach iframe to Dialog.
$("<div id=\"srch" + options.winId + "\" title=\"" + options.windowTitle + "\" style=\"padding-left:0px;padding-right:0px;padding-top:0px\" tabindex=\"-1\"><iframe src=\"" + url + "\" id=\"frame" + options.winId + "\" name=\"frame" + options.winId + "\" height=\"100%\" width=\"100%\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" tabindex=\"-1\"></div>").appendTo("body")
//Now initialize a Dialog Window
$('#srch' + options.winId).dialog({
autoOpen: (options.searchText == '') ? true : false,
height: options.height,
width: options.width,
modal: options.isModal,
closeOnEscape: true,
open: function () {
},
close: function () {
$('#srch' + options.winId).remove();
}
});
I have written this code inside the page which isopened through iFrame src.
$(document).ready(function () {
$('input1').focus().select();
});
How can i achieve this?
Thanks,
Huzefa