Reputation: 125
$( document ).ready(function() {
$('#somediv').load('chapter.php');
var a = $('#vplayer').width();
alert (a);
});
this is inside chapter.php:
<iframe class='viframe' id='vplayer' src='//www.youtube.com/embed/XotSjeW0uos?rel=0'></iframe>
Alert appears but result is NULL
.
All others elements are measured correctly.
Upvotes: 0
Views: 66
Reputation: 13829
You have to wait for it to load:
$( document ).ready(function() {
$('#somediv').load('chapter.php', function()
{
var a = $('#vplayer').width();
alert (a);
});
});
Upvotes: 1