My code:
HTML:
<iframe src="http://lorempixel.com/400/400/" width="400" height="400"></iframe>
JS:
$("iframe[scr*='http://lorempixel.com/400/400/']").css("border", "3px solid blue");
Jsfiddle:
Link to JsFiddle
Can seem to select the iframe via its source attribute.
Thank you in Advance.
You have a typo, The correct attribute you should be referencing is src
whereas your query is searching for an attribute named scr
which doesn't exist.
so instead of
$("iframe[scr*='http://lorempixel.com/400/400/']").css("border", "3px solid blue");
you should have
$("iframe[src*='http://lorempixel.com/400/400/']").css("border", "3px solid blue");
Reference:
You misspelled "src" in the jQuery selector. It is currently scr
, it should be src
.
Fixed code:
$("iframe[src*='http://lorempixel.com/400/400/']").css("border", "3px solid blue");
And fixed JSFiddle: http://jsfiddle.net/Je3SG/1/
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