Edit This Code:
See Result »
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.bootcss.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").toggleClass("main"); }); }); </script> <style> .main { font-size: 120%; color: red; } </style> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?73c27e26f610eb3c9f3feb0c75b03925"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </head> <body> <button>Toggle class "main" for p elements</button> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <p><b>Note:</b> Click the button more than once to see the toggle effect.</p> </body> </html>
Result: