选择除类别之外的具有特定ID的元素 [英] Select elements with class except one with specific id

查看:104
本文介绍了选择除类别之外的具有特定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.

有没有办法在第一行本身选择所有元素类ui-widget-content,但除了一个id为helpDialog的项目?

Is there any way in first line itself to select all elements with class "ui-widget-content" but except one with id "helpDialog"?

推荐答案

当然,使用 :not()

Sure, use :not():

$('.ui-widget-content:not(#helpDialog)').css('border', 0);

这篇关于选择除类别之外的具有特定ID的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆