How can we update the <param name='wmode' value='WINDOW'
to <param name='wmode' value='TRANSPARENT'
using jQuery?
After multiple attempts I've ended up using the following, but the element is not selected:
$(window).load(function () {
$("param[name='wmode'").attr('value', 'transparent')
});
Background:
The $(window).load(...
function is necessary. I've tested this same snippet omitting [name='wmode']
and every param is overwritten to <param name="wmode" value="transparent"...
, adding the [name='wmode']
breaks the selector somehow.
You have a typo in your selector. Update your code as follows:
$('param[name="wmode"]').prop('value', 'transparent');
Also, you might want to hook into the DOMReady function, not the window.load
event. Use the following code:
$(function() {
$('param[name="wmode"]').prop('value', 'transparent');
});
Also, note the use of prop()
, rather than attr()
. Here's the jQuery documentation:
The difference between attributes and properties can be important in specific situations. Before jQuery 1.6, the
.attr()
method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. As of jQuery 1.6, the.prop()
method provides a way to explicitly retrieve property values, while.attr()
retrieves attributes.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments