Gordon Gordon - 3 months ago 17
CSS Question

jquery, how to remove button colour after it has been pressed?

<button style="background-color:lightblue" id="extractv">

$("#extractv").click(function () {

After someone clicks on the button, I want to remove the background color on the button. I am not sure why it's not working.




I'm not exactly sure why the code you posted doesn't work but the following will do the trick

$(document).ready(function() {
    $('#extractv').click(function() {


jsfiddle version: http://jsfiddle.net/UUxHJ/

As others have pointed out though it's better (more future-proof) here to only remove the background-color versus completely taking out the style attribute.

$('#extractv').click(function() {