I have a html page. Inside it I use jQuery to attach click event on a link. Then I use iframe to reference this html page from another page. However I could not trigger the
Just place onload() event inside the iframe tag.
<iframe src="http://myURL.com" onload="myFunction()">
Here is how you can do it.
document.getElementById('ifrmMsg').contentWindow.$('a:first').trigger('click');
You can also use postMessage() for this purpose. It will work cross-domain as well. However JS inside the iframe must listen to the message event, i.e. you need to control the source of the iframe.