Assuming the iframe is on the same domain (otherwise it's not possible), you should wait for the iframe to load first :
$(document).ready(function() {
$( "#frameDemo" ).on('load', function() {
var mydiv = $(this).contents().find("div");
var h = mydiv.height();
alert(h);
});
});