首先; HTML 代码示例:
<div class"grap1"> some conetent</div>
<div class"grap2"> some conetent</div>
<div class"grap3"> some conetent</div>
<div class"blabla">some content></div>
现在我想选择类中包含“grap”单词的 div 是类名(所以在本例中是前三个 div)。我怎样才能做到这一点?
这不起作用:http://api.jquery.com/attribute-contains-word-selector/
最佳答案
使用attribute contains selector :
$('div[class*="grap"]')
关于jquery - 例如,选择类包含 "grap"(或其他指定单词)的 div(或其他元素),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7378382/