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

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

matlab - error with cyclic autocorrelation function -

php - Using grpc in Laravel, "Class 'Grpc\ChannelCredentials' not found." -