CodeLab
Show Output
 
 
 
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
<meta charset="utf-8">
5
<title>jQuery css()</title>
6
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
7
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
8
<script>
9
$(document).ready(function() {
10
  $("#button").click(function() {
11
     $("p").css({"font-size":"20px", "color":"#ff0000"});
12
  });
13
});
14
</script>
15
</head>
16
<body>
17
 <p>This is first paragraph</p>
18
 <p>This is another paragraph</p>
19
 <button style="margin:0 0 10px 0;background:#e8e8e8;" class="btn" id="button">Click here to set a specific value for all matched element</button><br />
20
 </body>
21
</html>                            
 

Share this example with Facebook, Twitter