I have a div with its default class giving it a green background. When the mouse is pressed, I want to change the background to red until the mouse is let go.
I have tried to addClass a class with a red background-color. The new class properties seem to not override the existing properties. I have the new class listed after the original in the .css file.
css
#calc_no { background-color: #cd9781; }
#calc_yes { background-color: #8fba8e; }
.button_click { background-color: red; }
jscript
$('.button').live('mousedown', function() {
$(this).addClass("button_click");
});
$('.button').live('mouseup', function() {
$(this).removeClass('button_click');
});
html
<div id="calc_yes" class="kp_button button">Yes</div>