为了账号安全,请及时绑定邮箱和手机立即绑定

假设jquery不包含某个类,如下内容该怎么解决?

假设jquery不包含某个类,如下内容该怎么解决?

喵喵时光机 2022-02-11 17:07:22
jquery不包含某个类比如说现在我有<ul id="main"><li class="one"></li><li class="one two">XX</li><li class="one">XX</li><li class="one">XX</li></ul>我想选择只有one这个类的所有li,不选择有one two 这两个类的li。这是一个导航条。two这个类不是一直待在第二li 的不好意思忘记了,如果没有one,如下应该如何选择<ul id="main"><li></li><li class="two">XX</li><li>XX</li><li >XX</li></ul>
查看完整描述

2 回答

?
慕运维8079593

TA贡献1876条经验 获得超5个赞

Js代码  

1 、$('li').not(':even').css('background-color', 'red');  


    Js代码  

    1、 $('li').not(document.getElementById('notli'))  

    2  、 .css('background-color', 'red');  


    Js代码  

    1、 $("div").not(".green, #blueone")  

    2 、          .css("border-color", "red");  


    Js代码  

    1 、Example: Removes the element with the ID "selected" from the set of all paragraphs.  


    2、 $("p").not( $("#selected")[0] )  。

    3 、Example: Removes the element with the ID "selected" from the set of all paragraphs.  


    4 、$("p").not("#selected")  。

    5 、Example: Removes all elements that match "div p.selected" from the total set of all paragraphs.  


    6 、$("p").not($("div p.selected"))  。


    Js代码  

    1、 $("#reset").click(function() {  。

    2 、  $(':input','#fundingpossibility')  。


查看完整回答
反对 回复 2022-02-14
?
千巷猫影

TA贡献1829条经验 获得超7个赞

$("li[class='one'][class!='two']")

查看完整回答
反对 回复 2022-02-14
  • 2 回答
  • 0 关注
  • 400 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号