• JQUERY中INDEX使用要注意的地方


    JQUERY中INDEX使用要注意的地方

    定义:

      $("#id").index(obj)返回int类型

    =========Demo===============

    HTML:

    <table id="tb">

      <tr id="tr">

        <td><span onclick="GetPos(this)">0</span></td>

        <td><span onclick="GetPos(this)">1</span></td>

        <td><span onclick="GetPos(this)">2</span></td>

        <td><span onclick="GetPos(this)">3</span></td>

      </tr>

    JS:

      function GetPos(item){

        var clickItem=$(item);

        var pos = $("#tb tr") .eq(0).find("td").index(clickItem);//var pos = $("#tr td").index(clickItem);

        alert(pos);

      }

      错误写法:

            var pos = $("#tb tr") .eq(0).index(clickItem);

          or

          var pos = $("#tr").index(clickItem);

      注意:

        index的父元素是一个集合!!!

    .....................................................................OVER

    参考资料:

    -------------------------------------------------------------------------------------------------------------------------------------------------
    数据库优化
    数据库教程
    数据库实战经验分享博客

    百度云下载

    评测


  • 相关阅读:
    lnmp 优化
    linux-lnmp 搭建报错
    nfs 配置
    全网备份脚本rsync
    .Net面试题二
    软件设计模式
    .Net面试题一
    asp.net运行机制
    NHiberante的优缺点
    什么是架构、框架、模式和平台
  • 原文地址:https://www.cnblogs.com/longle/p/index.html
Copyright © 2020-2023  润新知