- 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
How to use *= operator in jQuery attribute selector?
The *= operator is used to filter elements for attribute containing the given value.
Example
You can try to run the following code to learn how to *= operator to filter attributes on the basis of text:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $( "div[myattr*='subject']" ).css("background-color", "yellow"); }); </script> </head> <body> <div myid="sub1" myattr="javasubject">Java</div> <div myid="sub2" myattr="htmlsubject">HTML</div> <div myid="sub3" myattr="ruby">Ruby</div> </body> </html>
- Related Articles
- How do we use # in jQuery Attribute Selector?
- How do we use jQuery Attribute selector with a period?
- jQuery [attribute!=value] Selector
- How to make jQuery attribute selector case insensitive?
- How to use universal (*) selector in jQuery?
- How to combine a class selector and an attribute selector with jQuery?
- How to pass a variable into a jQuery attribute-contains selector?
- How to write a jQuery selector to find links with # in href attribute?
- How do we use jQuery selector eq:()?
- How to use OR Operation in jQuery Attribute Selectors?
- How do we use .not() with jQuery selector?
- How to get value of data attribute and use it in jQuery?
- How to escape square brackets in jQuery selector?
- How to use attr() method in jQuery to get the value of an attribute?
- Is it possible to use $(this) and universal selector (*) with jQuery?

Advertisements