Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest May 16th, 2018 97 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. $("#inputId").toggle(
  2.       function () {
  3.         $(this).addClass('someClass');
  4.       },
  5.       function () {
  6.         $(this).addClass('differentClass');
  7.       }
  8. );
  9.    
  10. <input id="MyButton" type="button" value="Click me" class="Color1" />
  11.    
  12. <script type="text/javascript">
  13.     $(document).ready(function() {
  14.         $("#MyButton").click(function() {
  15.             if ($(this).attr("class") == "Color1") {
  16.                 $(this).attr("class", "Color2");
  17.             }
  18.             else {
  19.                 $(this).attr("class", "Color1");
  20.             }
  21.         });
  22.     });
  23. </script>
  24.    
  25. $("button").click(function () {
  26.  
  27.     $('#blue').toggleClass("red");
  28.  
  29.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top