From jQuery JavaScript Library
« Back to Selectors
[attribute!=value]
Matches elements that don't have the specified attribute with a certain value.
Arguments:| attribute | String | |
|---|
| An attribute name. |
| value | String | |
|---|
| An attribute value. Quotes are optional in most cases, but should be used to avoid conflicts when the value contains characters like "]". |
Examples:| Name | Type |
Finds all inputs that don't have the name 'newsletter' and changes the text of the span next to it.
$("input[name!='newsletter']").next().text(" is not newsletter");
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="../jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("input[name!='newsletter']").next().text(" is not newsletter");
});
</script>
</head>
<body>
<div>
<input type="radio" name="newsletter" value="Hot Fuzz" />
<span>name?</span>
</div>
<div>
<input type="radio" name="newsletter" value="Cold Fusion" />
<span>name?</span>
</div>
<div>
<input type="radio" name="accept" value="Evil Plans" />
<span>name?</span>
</div>
</body>
</html>