Home >>jQuery Tutorial >jQuery [attribute*=value] Selector
jQuery [attribute*=value] selector in jQuery is used to selects each element with a specific attribute, with a value containing a string.
Syntax:
$("[attribute*='value']")
Parameter | Description |
---|---|
attribute | It is a Required parameter and used to specifies the attribute to find |
value | It is a Required parameter and used to specifies the string value |
Here is an Example of jQuery [attribute*=value] Selector:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input[name*='nation']").css("background-color", "#4796d6");
});
</script>
</head>
<body>
<input name="nationality" type="text" value="Indian">
<input name="nation" type="text" value="Hindi">
<input name="country" type="text" value="India">
</body>
</html>