List to green by click button

Hello

I want to make a line of a list to green color by click button: http://jsfiddle.net/8Observer8/sPLX7/

Thank you for advance!

Instead of this.css( “backgroundColor”, “green” );
use $(this).css( “backgroundColor”, “green” );

You can also use “background-color” instead of “backgroundColor”. :slight_smile:

Thank you! But it doesn’t work yet: http://jsfiddle.net/8Observer8/sPLX7/3/

And this too function( $( this ): http://jsfiddle.net/8Observer8/sPLX7/5/

Change this:

$( document ).ready( function( ) {
    $( "#content" ).show( );
    $( "li" ).click( function( $( this ) ) {
        $( this ).css( "background-color", "green" );
    } );
} );

To this:

$("#content").show();
$("li").click(function(){
    $(this).css("background-color", "green");
});