Javascript examples for jQuery Method and Property:addClass
Use a jQuery method to add the "important" class to the <p> element.
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").addClass("important"); });/*from ww w.ja va 2 s . c o m*/ </script> <style> .important { font-weight: bold; font-size: xx-large; background-color: yellow; } </style> </head> <body> <p>This is a paragraph.</p> </body> </html>