javascript - added js code doesn't work in iframe -


i have iframe containing div tag "firstheadsection" id.

after iframe loaded, append code iframe:

    <script>     $(window).on("resize", function(){     alert($("#firstheadsection").height())     })     </script> 

the js code inserted after resize window, alerts null.

jquery included in iframe.

what should do?

you have access main page, have prepend "parent". try this: (not tested)

parent.$.fn.resize(function() {     alert($("#firstheadsection").height()); }); 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -