Is it possible to refer to an attribute of an element conditionally with Jquery?
What I'm after is something开发者_运维问答 like:
$(".mylink":rel["2"]).show();
... which would "show the specific instance of .mylink element on the page that has rel="2" HTML attribute on it. There would be multiple instances of .mylink on the page, each with its own "rel" value.
Thank you.
Like this:
$('.mylink[rel=2]').show();
If the "rel" value is a variable or something, you can do:
$('.mylink[rel=' + relValue + ']').show();
精彩评论