JQuery Add with css()

 

In this example we are add javascript element with css() method and this will be change the background color of text

 
 
 
<!Doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> </head> <body> <h1>Appwrk IT Solution</h1> <span id="span1" style="font-size: 30px">Best software company!</span> <script> $( "h1" ).add( document.getElementById( "span1" ) ).css( "background", "cyan" ); </script> </body> </html>
Output