ドキュメント

Selectors/attributeMultiple

From jQuery JavaScript Library

Jump to: navigation, search

« Back to Selectors

[attributeFilter1][attributeFilter2][attributeFilterN]

Matches elements that match all of the specified attribute filters.
Arguments:

attributeFilter1Selector
An attribute filter.
attributeFilter2Selector
Another attribute filter, reducing the selection even more
attributeFilterN (Optional)Selector
As many more attribute filters as necessary
Examples:

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

$("input[id][name$='man']").val("only this one");

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    $("input[id][name$='man']").val("only this one");
  });
  </script>
  
</head>
<body>
  <input id="man-news" name="man-news" />
  <input name="milkman" />
  <input id="letterman" name="new-letterman" />
  <input name="newmilk" />
</body>
</html>

NameType