Примеры для jQuery Селектор по нескольким атрибутам [name=”value”][name2=”value2″]


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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>attributeMultiple demo</title>
<script src="https://code.jquery.com/jquery-1.10.2.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>

Демонстрация: