How can I access the function declared in the iframe from the parent document? On native JS or with jQuery - no difference.

    2 answers 2

    Like this:

    document.getElementById("идВашегоФрейма").contentWindow.вашаФункция(); 

    Works in all modern browsers.

    • Thank you, I did, but it seems that I was wrong somewhere and dropped this method. Now I tried again - everything is ok. - Oleg Arkhipov
     window.frames['FrameName'].someFunction(); 

    But this is possible provided that the domain of the parent and the frame are the same