<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');
You can do it like this:
$("img[pngSet]").css('border' ,'1px solid red');
The has attribute selector is just [attributeName]
:)
Should be:
$('img[pngSet]')
Give this a shot (using the has attribute selector):
$("img[pngSet]")
$("img[pngSet]");
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');
精彩评论