- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
jQuery [attribute!=value] Selector
The [attribute!=value] selector in jQuery is used to select each element that isn’t having the specified attribute and value.
Syntax
The syntax is as follows −
$("[attribute!='value']")
Example
Let us now see an example to implement the jQuery [attribute!=value] selector −
<!DOCTYPE html> <html> <head> <style> .one { color: white; background-color: orange; font-size: 16px; border: 2px blue dashed; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p[class!='demo']").addClass("one"); }); </script> </head> <body> <h1>Car Details</h1> <p>Car is XUV500</p> <p class="demo">2179 cc</p> <p>Independent Suspension</p> <p>Fuel Tank Capacity: 70 litres</p> </body> </html>
Output
This will produce the following output −
- Related Articles
- How to make jQuery attribute selector case insensitive?
- How to use *= operator in jQuery attribute selector?
- How do we use # in jQuery Attribute Selector?
- How to combine a class selector and an attribute selector with jQuery?
- Role of CSS [attribute="value"] Selector
- How do we use jQuery Attribute selector with a period?
- How to pass a variable into a jQuery attribute-contains selector?
- Change input type value attribute in jQuery
- How to write a jQuery selector to find links with # in href attribute?
- jQuery :button Selector
- jQuery :checkbox Selector
- jQuery :checked Selector
- jQuery :contains() Selector
- jQuery :disabled Selector
- jQuery :empty Selector

Advertisements