jQuery Style How to - Remove button colour after it has been pressed by removing its class








Question

We would like to know how to remove button colour after it has been pressed by removing its class.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.4.4.min.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!--from  w  w w . ja  va 2 s  .  c om-->
$(document).ready(function() {
    $('#target').click(function() {
       $(this).removeAttr('style');
    }); 
});
});
</script>
</head>
<body>
  <button style="color: blue" id='target'>here</button>
</body>
</html>

The code above is rendered as follows: