【原创】jQuery id 模糊匹配元素

[属性名称] 匹配包含给定属性的元素
[att=value] 匹配包含给定属性的元素 (大小写区分)
[att*=value] 模糊匹配
[att!=value] 不能是这个值
[att$=value] 结尾是这个值
[att^=value] 开头是这个值
[att1][att2][att3]... 匹配多个属性条件中的一个

匹配 ID 以 gro 开头的元素

$('div[id^=gro_]').attr("style","display:none;");

匹配 label 元素 ID 是 xxx-error 的(validate 提示错误元素)

$("label[id*='-error']").remove();
点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注