I'm looking for a way to target this jquery only at src url's that have "youtube.com" in them. I've tried using the :contains selector but I can't get it working correctly.
jQuery(document).ready(function($){
$('iframe').each(function() {
var url = $(this).attr("src")
$(this).attr("src",url+"&wmode=transparent")
});
});
Use the attribute selector to target only iframes with a src containing youtube.com:
jQuery(document).ready(function($){
$('iframe[src*="youtube.com"]').each(function() {
var url = $(this).attr("src")
$(this).attr("src",url+"&wmode=transparent")
});
});
&. There is no need to escape the entity - Aaron 2012-04-04 02:00
& need to be escaped in the src attribute? I'm pretty sure it doesn't - Blender 2012-04-04 02:24
&need to be escaped - Blender 2012-04-04 01:50