Try the following instead. window.load is not a good way to handle document elements.
$(document).ready(function(){ var temp = $('.mobEvents').height(); alert(temp); });
If you have several elements with one class, it will receive only the first element.
$(document).ready(function(){ var temp = $('.mobEvents':First).height(); alert(temp); });
or alternatively you can use
$(document).ready(function(){ var temp = $('.mobEvents').attr("height").value(); alert(temp); });
source share