
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
Define Multiple CSS Attributes in jQuery
To define multiple CSS attributes in jQuery, use the css selector or the addClass() method. Let’s see how to do it using css selector.
Pair up strings representing property names with the corresponding values.
Example
You can try to run the following code to learn how to define multiple CSS attributes in jQuery:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#demo").css({ "background-color": "#F1F1F1", "font-style" : "italic" }); }); </script> </head> <body> <h1 id="demo">Countries</h1> </body> </html>
Advertisements