zoukankan      html  css  js  c++  java
  • jQuery的选择器中的通配符

    (1)通配符:

    $("input[id^='code']");//id属性以code开始的所有input标签

    $("input[id$='code']");//id属性以code结束的所有input标签

    $("input[id*='code']");//id属性包含code的所有input标签

    $("input[name^='code']");//name属性以code开始的所有input标签

    $("input[name$='code']");//name属性以code结束的所有input标签

    $("input[name*='code']");//name属性包含code的所有input标签

    $("input[name*='code']").each(fuction(){

        var sum=0;

    if($(this).val()!=""){

      sum=parseInt(sum)+parseInt($(this).val());

    }

    $("#").text(sum);

    })

    (2)根据索引选择

    $("tbody tr:even"); //选择索引为偶数的所有tr标签

    $("tbody tr:odd"); //选择索引为奇数的所有tr标签

    (3)获得jqueryObj下一级节点的input个数

    jqueryObj.children("input").length;

    (4)获得class为main的标签的子节点下所有标签

    $(".main > a");

    (5)选择紧邻标签

    jqueryObj.next("div");//获取jqueryObj标签的后面紧邻的一个div,nextAll获取所有

    摘要来源:http://ayue05.blog.163.com/blog/static/1341345912015028113728833/

  • 相关阅读:
    WebSocket简单通信
    python必会内置函数
    python装饰器
    Python常用模块1
    python函数操作
    python字典操作
    python切片操作
    python列表操作
    python字符串格式化的几种方式
    Jmeter响应中中文乱码怎么解决?
  • 原文地址:https://www.cnblogs.com/Thinkingcao/p/8432558.html
Copyright © 2011-2022 走看看