Select elements with class except one with specific id
$('.ui-widget-content').css('border','none');
$('#helpDialog .ui-widget-content').addClass('HelpDialogBorder');
I am doing like this to remove border. But, there is an element where I want to keep border.
Is the开发者_运维百科re any way in first line itself to select all elements with class "ui-widget-content" but except one with id "helpDialog"?
Sure, use :not()
:
$('.ui-widget-content:not(#helpDialog)').css('border', 0);
Try this (also see my jsfiddle):
$('.ui-widget-content').not('#helpDialog').css('border','none');
You can try this $('.ui-widget-content').not('#id')
精彩评论