Attribute ends with ([foo$=bar])
In this chapter you will learn:
Description and Syntax
$('[foo$=bar]')
selects all elements that have the foo
attribute with a value ending with bar
.
Examples
Selector | Selects |
---|---|
$('[id$=yourValue]') | all elements that have an ID ending with yourValue |
$('input[name$=yourValue]') | all <input> elements that have a name value
ending with yourValue |
The following code selects all inputs with an attribute name
that ends with 'b
'.
<html><!--from ja v a 2s . c o m-->
<head>
<script src="http://java2s.com/style/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("input[name$='b']").val("a");
});
</script>
</head>
<body>
<body>
<input name="ab" />
</body>
</html>
Next chapter...
What you will learn in the next chapter: