Search code examples
jqueryobjectembedattributeswmode

Add attribute to embed tag using jquery


I have the following embed tag:

<embed type="application/x-shockwave-flash" width="640" height="505" src="url_to_video" allowscriptaccess="always" allowfullscreen="true"></embed>

I have about five of theses on a page, and I'd like to add the attribute wmode="opaque" to all of them. However, I tried to do it like this and it didnt' work:

$j("embed").attr('wmode','opaque');

Is there another way I can dynamically set the attribute wmode="opaque" ?

Thanks!


Solution

  • I ened up using a regular expression instead of jquery to get this to work.