开发者

How to select these elements

I'd like to handler all elements with the attribute rel inside of an a elemen开发者_运维百科ts that start with string lightbox.

How can I do it with jQuery?


With the attribute-starts-with selector:

$('a [rel^="lightbox"]')


you need startswith selector

 $('a[rel^="lightbox"]')


Use the attribute starts with selector.

$('a [rel^="lightbox"]')

EDIT: having re-read your question, it sounds like this may be what you want:

$('a[id^="lightbox"] [rel]')

This selects all elements that have the attribute rel and are within an a tag that has an ID starting with lightbox.


Just to be different... if it is a prefix (i.e. "lightbox-") you can use the |= selector.

$('a[rel|=lightbox]')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜