首页 > Web开发 > 详细

9、第九节课jquery选择器jq2,20151007

时间:2015-10-07 22:38:28      阅读:276      评论:0      收藏:0      [点我收藏+]

1、表单选择器

 

2、not 里面不能加其他标签

  $div p:not(not:disable)  错误的

  $div p:not(:disable)  正确的

3、选择设置相应属性的标签项

  $("img[title]");

  $("img[title]").eq[1];

4、获取所有DIV中设置title属性为‘你好’的div 索引

  $("div").index($("div[title=‘你好‘]"));

 5、title 属性为你好的第二个div 的索引

  $("div").index($("div[title=‘你好‘]").eq[1]);

6、鼠标定位

  $("div").click(function()

  {alert($(this).index());

  alert($(this).text); // 获取点击DIV 的内容

})

7、JQuery 链

  技术分享

8、遍历

  

    
 $("#btn").click(function () {
        $("div").each(function (index) {
            var i = index + 1;
            $(this).attr("title", "我是第" + i + "个div");
        }); 

9、获取属性只 attr

  $("div").eq(3).css("title","你好我是第四个");

9、第九节课jquery选择器jq2,20151007

原文:http://www.cnblogs.com/stonecoolboy/p/4859571.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!