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")
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With