编写一个jquery选择器来选择具有特定模式的类 [英] Write a jquery selector to select a class with a certain pattern

查看:81
本文介绍了编写一个jquery选择器来选择具有特定模式的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何选择一些类名模式为 a-< random> -c 的div。

How can I select some divs with class name pattern a-<random>-c.

推荐答案

您可以找到有用的信息 此处

You may find useful information Here.

您的情况可能会有效

$("div:regex(class, .a*c)").jqFunction()

for匹配选择器字符串的开头

for matching the starting of selector string

<script>$('input[name^="txt"]').val('content here!');</script>

this查找所有输入,其属性名称以'txt'开头并将文本放入其中。

this Finds all inputs with an attribute name that starts with 'txt' and puts text in them.

<script>
$("div:contains('new')").css("text-decoration", "underline");
    </script>

查找包含new的所有div并将其加下划线。

Finds all divs containing "new" and underlines them.

<script>$('[name$="address"]').val('a letter');</script>

查找属性名称以地址结尾并将文本放入其中的所有输入。

Finds all inputs with an attribute name that ends with 'address' and puts text in them.

这些组合可能对您有所帮助

Combination of these may be helpful to you see if it helps

这篇关于编写一个jquery选择器来选择具有特定模式的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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