Reputation: 133
<IMG height="160" alt="Web Content Image" src="../image/journal/article?img_id=16505&t=1273484793531" width="240" pngSet />
I have the this code for the image , and I want to select the image based on the attribute "pngSet"
I am trying this , but not working.
$("img[pngSet='']").css('border' ,'1px solid red');
Upvotes: 0
Views: 1744
Reputation: 3389
Give this a shot (using the has attribute selector):
$("img[pngSet]")
Upvotes: 1
Reputation: 38431
It's usually a bad idea to make up attributes. Browsers don't have to support it. Best would be to use a class instead:
<IMG height="160" alt="Web Content Image" src="../image/journal/article?img_id=16505&t=1273484793531" width="240" class="pngSet" />
$("img.pngSet").css('border' ,'1px solid red');
Upvotes: 0
Reputation: 630549
You can do it like this:
$("img[pngSet]").css('border' ,'1px solid red');
The has attribute selector is just [attributeName]
:)
Upvotes: 4