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]')
精彩评论