Javascript examples for jQuery:Form Button
Change class of a span inside a button on click
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function(){ $("#btn_new").click(function(){ $(this).find('span').toggleClass('main'); });//from w ww. j a v a 2 s .co m }); </script> <style> .main { font-size: 120%; color: red; } </style> </head> <body> <button type="button" id="btn_new"> <span class="main">new</span> </button> </body> </html>