Reputation: 395
How can I get the value of flashvars
attribute?
<div>
<embed height="360"
src="//www.youtube.com/get_player?enablejsapi=1"
type="application/x-shockwave-flash"
width="100%"
allowfullscreen="true"
allowscriptaccess="always"
bgcolor="#fff"
scale="noScale"
wmode="opaque"
flashvars="fmt_list=34%2F640x336%2F9%2F0%2F115%2C5%2F426x224%2F7%2F0%2F0&fmt_stream_map=34%7Chttp%3A%2F%2Fredirector.googlevideo.com%2Fvideoplayback%3Fid%3Da067d9378dddd818%26itag%3D34%26source%3Dpicasa%26cmo%....">
</embed>
</div>
I am using getElementsByTagName
to get the element
var codedLink = content.document.getElementsByTagName('embed');
but when I try codedLink.flashvars
I get undefined.
Upvotes: 1
Views: 1490
Reputation: 955
you can use .attr("/* attribute name */")
$(document).ready( function() {
console.log($('embed').attr('flashvars'));
});
Upvotes: 0
Reputation: 388316
getElementsByTagName(), returns an array of dom element references, so you need to access the element by using array index first
you need to use
codedLink[0].getAttribute('flashvars')
Upvotes: 2