javascript - Height of div element returns zero -
does know why height 0 here?
$(document).ready(function () { alert($("#hello").height()); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <img id="hello" class="browseimg" src="https://udemy-images.udemy.com/course/750x422/64132_926c_10.jpg" />
it because after dom loaded successfully, getting height of image before image loading network.
probably have in load event of image.
$('#hello').load(function() { alert($("#hello").height()); });
Comments
Post a Comment