选择以课程结尾的div [英] Select div that ends with a class
本文介绍了选择以课程结尾的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
喜欢这个:
<div class="abc foo-something">
如何选择以-something
结尾的类的div
?
How can I select div
that has a class ending in -something
?
推荐答案
@Einacio指出$("div[class$='-something']")
对<div class="foo-something abc">
不起作用是正确的.要选择这种情况,您可以添加第二个选择器,结果如下:
@Einacio commented correct that $("div[class$='-something']")
will not work for <div class="foo-something abc">
. To select and this case you can add a second selector, with the following result:
$("div[class$='-something'],div[class*='-something ']")
这将选择以-something结尾的类,并在其后跟随一个空格.
This will select and classes that ending with -something and a space follows.
检查此以了解更多信息.
这篇关于选择以课程结尾的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文