开发者

Select elements with class except one with specific id

开发者 https://www.devze.com 2023-04-10 00:36 出处:网络
$(\'.ui-widget-content\').css(\'border\',\'none\'); $(\'#helpDialog .ui-widget-content\').addClass(\'HelpDialogBorder\');
$('.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')

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号