jquery Iframe src attribute
- by alex
Why does x alerts undefined for iframe but works for embed. I'm grabbing the iframe or embed code from a textarea
<iframe src="http://www.youtube.com/embed/9kiWvkj2ldWiU?hd=1"></iframe>
var textarea = $('#embedModal textarea'),
textareaValue = textarea.val(),
$embed = $($(textareaValue).find('iframe')),
x = $embed.attr('src');
alert(x); //alerts undefined for iframe
If you change find('iframe') to find('embed') and you try with the below embed code. then i'm able to get the value of src, but with iframe i get undefined. Seems strange.
<embed src="http://www.youtube.com/embed/9kiWvkj2ldWiU?hd=1"></embed>