jQuery选择器正则表达式 [英] jQuery selector regular expressions
问题描述
我正在使用jQuery选择器来使用通配符或正则表达式(不确定的确切术语)的文档。
I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.
我自己一直在寻找这个但是已经无法找到有关语法和如何使用它的信息。有谁知道语法的文档在哪里?
I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the syntax is?
编辑:属性过滤器允许您根据属性值的模式进行选择。
The attribute filters allow you to select based on patterns of an attribute value.
推荐答案
James Padolsey创建了一个精彩过滤器,允许使用正则表达式进行选择。
James Padolsey created a wonderful filter that allows regex to be used for selection.
假设你有以下 div
:
<div class="asdf">
Padolsey的:正则表达式
过滤器可以选择它所以:
Padolsey's :regex
filter can select it like so:
$("div:regex(class, .*sd.*)")
另外,请查看官方关于选择者的文件。
这篇关于jQuery选择器正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!