选择该类包含"grap"的div(或其他元素). (其他指定字词)例如 [英] Select div (or other element) that class contains "grap" (o other specified word) for example

查看:84
本文介绍了选择该类包含"grap"的div(或其他元素). (其他指定字词)例如的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先; HTML代码示例:

First of all; example of HTML code:

<div class"grap1"> some conetent</div>
<div class"grap2"> some conetent</div>
<div class"grap3"> some conetent</div>
<div class"blabla">some content></div>

现在我要选择该类中包含废话"字的div是类名(因此在本例中为前三个div).我该如何实现?

And now i want to select divs that class contains "grap" word somewhere is class name (so in this case first three divs). How can i achieve that ?

这不起作用: http://api.jquery.com/attribute- contains-word-selector/

推荐答案

使用包含选择器的属性:

$('div[class*="grap"]')

这篇关于选择该类包含"grap"的div(或其他元素). (其他指定字词)例如的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆