jquery - How can I change the css of this when I click on anything but this? -


i attempting change css of menu items clicking anywhere else on screen. reset they're css properties after clicking on them , changing css they're defaults.

if have list item id="linkitem" how click on #linkitem change css of it.

thanks

$(document).on('click', function(e) {     if ( ! $(e.target).closest('#linkitem').length ) {         // clicked anywhere on element inside #linkitem (or itself)         $('#linkitem').css('color', 'red');     } }); 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -