I have one html page with one iframe
in parent frame, I have

        $('#x').bind('blur',function(){alert(1)});
        <input id='x' name='text'></input>

in the iframe, I can use

        $('#x',parent.document.body).val();

to retrieve the parent element value,
but I cannot use

        $('#x',parent.document.body).blur();

to trigger the blur event

my solution is create another function in parent and trigger that
function, but I just curious why the above code doesn't work?

my solution
in parent frame
        $('#x').bind('blur',function(){alert(1)});
        function parenttrigger(id){$(id).blur();}
        <input id='x' name='text'></input>
in the iframe
         parent.parenttrigger('#x');


But I feel that this solution is a little bit ugly, can I trigger the
blur event directly? Did I make any mistakes?

Reply via email to