Multiple Attribute Selector [name=value][name2=value2]

attributeMultiple selector

version added: 1.0jQuery('[attributeFilter1][attributeFilter2][attributeFilterN]')

  • attributeFilter1
    一个属性过滤器.
    attributeFilter2
    另一个属性过滤器, 减少选择甚至更多
    attributeFilterN
    根据需要有更多的属性过滤器

描述: 选择匹配所有指定的属性筛选器的元素

Example:

Finds all inputs that have an id attribute and whose name attribute ends with man and sets the value.

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <input id="man-news" name="man-news" />

  <input name="milkman" />
  <input id="letterman" name="new-letterman" />
  <input name="newmilk" />
<script>$("input[id][name$='man']").val("only this one");</script>

</body>
</html>

Demo:

jQuery 1.6 API 中文版脚本之家整理、修订 (2011年6月)