Jquery Multiple Css Example - Jquery

How to add multiple css attributes in jquery?

Snippet Code


  
Rate this page :
  [ 0 votes]

Simple jquery multiple css code which allows to set the multiple css properties for selected elements. The sample code to set css properties is given below.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script> $(document).ready(function(){ $("#btn").click(function(){ $("p").css({"background-color": "yellow", "font-size": "1.5em", "color": "red"}); }); }); </script> <div align='center'> <p> Welcome to Hscripts Snippets!!! </p> <input type='button' id='btn' value='Click'> </div>

Tags


Ask Questions

Ask Question