Focus element inside iframe when iframe attached to Jquery Dialog

Posted by huzzy143 on Stack Overflow See other posts from Stack Overflow or by huzzy143
Published on 2010-05-29T07:47:49Z Indexed on 2010/05/29 7:52 UTC
Read the original article Hit count: 301

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about jquery-ui

Related posts about dialog