How do I select an iframe by the src attribute using jQuery?
html, javascript, jquery, jquery-selectors
Solution
Solution
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");
Example
> here's a jsfiddle which shows this typo corrected
Reference:
- http://reference.sitepoint.com/html/img/src
Problem
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.