开发者

jQuery: Selecting custom html tags (with specific values)

I have an html page which has elements such as the following:

<input data-required-by="books magazines stationery">

What I'd like to do is select all elements in jQuery that have "books" in the 'data-required-by' field. I was hoping something such as the following would work:

$("[data-required-by]~='books'")

but it brings back "Syntax error, unrecognized expression: ='books'"

Admittedly my jQuery isn't particularly advanced, so it's possible I've missed something simple. Any suggestions appreci开发者_如何学Pythonated


$("input[data-required-by~=books]")


$('[data-required-by^=books]')
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜