jQuery css() set more than one value

Description

jQuery css() set more than one value

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>/*from w w  w. j av  a  2s.  c o m*/
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").css({
      "color": "blue",
      "background-color": "red",
      "font-family": "Arial",
      "font-size": "20px",
      "padding": "5px"
    });
  });
});
</script>
</head>
<body>

<button>Set multiple CSS properties for all p elements</button>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

</body>
</html>



PreviousNext

Related