Attribute Ends With Selector [name$=value]

attributeEndsWith selector

version added: 1.0jQuery('[attribute$=value]')

  • attribute
    一个属性名.
    value
    一个属性值,引号是可选的.

描述: 选择指定属性是以给定值结尾的元素。这个比较是区分大小写的。

Example:

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

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

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

</body>
</html>

Demo:

设计酷,jquery1.6 api中文手册