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
Post a Comment