Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 there any way in first line itself to select all elements with class "ui-widget-content" but except one with id "helpDialog"?

like image 288
Pit Digger Avatar asked Dec 17 '22 08:12

Pit Digger


2 Answers

Sure, use :not():

$('.ui-widget-content:not(#helpDialog)').css('border', 0);
like image 123
thirtydot Avatar answered Dec 30 '22 11:12

thirtydot


Try this (also see my jsfiddle):

$('.ui-widget-content').not('#helpDialog').css('border','none');
like image 29
scessor Avatar answered Dec 30 '22 11:12

scessor