I have a list of links that open in an iframe, like:
<ul id="frameTrigger"> <li><a target="iframe1" href="aaa.html"><img src="aaa.jpg"></a></li> <li><a target="iframe1" href="bbb.html"><img src="bbb.jpg"></a></li> <li><a target="iframe1" href="ccc.html"><img src="ccc.jpg"></a></li> </ul> I need to update another div after the link is clicked. Specifically, I need to call a function that checks the frame's src attribute and update the div. If I do a:
$("#frameTrigger a").click(function() { var iframe = $("iframe[name=iframe1]").get(0); console.log(iframe.contentWindow.location.href); // the problem here is that that the iframe.window.location will // change AFTER this function returns }); I do not get what is expected.
$("#frameTrigger")you are missing # ... just in case