
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
Combine Class Selector and Attribute Selector with jQuery
A jQuery Selector is a function which makes use of expressions to find out matching elements from a DOM based on the given criteria. We can easily combine a class selector and an attribute selector with jQuery.
You can try to run the following code to learn how to How to combine a class selector and an attribute selector with jQuery −
Example
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function() { $('.myclass[reference="12345"]').css("background-color", "yellow"); }); </script> </head> <body> <table> <tr class="myclass" reference="12345"> <td>Row 1 Column 1</td> </tr> <tr class="myclass" reference="43215"> <td>Row 2 Column 1</td> </tr> <tr class="myclass" reference="54321"> <td>Row 3 Column 1</td> </tr> </table> </body> </html>
Advertisements