jquery不等于属性选择器是什么


当前第2页 返回上一页

以下代码展示获取ID不等于cheese的所有元素。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

<!DOCTYPE html>

<html>

    <head>

        <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>

    </head>

    <body>

        <div id="eggs"></div>

        <div id="ham"></div>

        <div id="cheese"></div>

        <script>

            var n = $("[id!='cheese']").length;

            alert(n);

        </script>

    </body>

</html>

以下代码选择所有input的名称不为me的输入框元素。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

<html>

  <head>

    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>

    <script type="text/javascript">

    $(document).ready(function(){

          $("input[name!='me']").next().text(" changed");

    });

    </script>

  </head>

  <body>

      <div>

        <input type="radio" name="you" value="A" />

        <span>data</span>

      </div>

      <div>

        <input type="radio" name="me" value="B" />

          <span>data</span>

      </div>

      <div>

        <input type="radio" name="me" value="C" />

        <span>data</span>

      </div>

  </body>

</html>

以上就是jquery不等于属性选择器是什么的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

jQuery中html乱码怎么办

jQuery如何使用css方法让按钮不可点击

jQuery 如何判断 是否相等

input输入框用jQuery怎么写失去焦点事件

jQuery中prop什么意思

详解jQuery中extend()和jQuery.fn.extend()的区别

jQuery中find()与children()的区别是什么?

如何解决jQuery $.post 乱码问题

jQuery 轮播图怎么写

jQuery 怎么写if

更多相关阅读请进入《jQuery》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...