
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use OR Operation in jQuery Attribute Selectors
Use comma to work with OR operation in jQuery Attribute Selector.
Example
You can try to run the following code to learn how to use OR operation in jQuery attribute selector:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $('[myattr=demo][myid="sub1"],[myattr=demo][myid="sub3"]').css("background-color", "yellow"); }); </script> </head> <body> <div myid="sub1" myattr="demo">Java</div> <div myid="sub2" myattr="demo">HTML</div> <div myid="sub3" myattr="demo">Ruby</div> </body> </html>
Advertisements