Tuesday, April 24, 2012

Changing DIV colors using hover and click in JQuery

Could someone please help. I have these two:



I would like the text to change to lightgreen when hovering, white when not hovering, and red when clicked.



$(".music").hover(
function() {
$(this).css('color','lightgreen');
},
function() {
$(this).css('color', 'white');
}
);

$(".music").click(function () {
$('#result').load('album_list_index.php');
$(this).css({ 'color': 'red', 'font-size': '100%' });
});


Thank you in advance



AC



NOTE: ok im sorry i did not make myself clear.



I need the div to be white when not mousedover
I need it to be gree when mouseover
And i need it to be red when clicked, and remain red until another button is clicked.





No comments:

Post a Comment