I often find myself doing things like this when manipulating tables:-

我经常发现我自己做这样的事情当操作表格:-

$($('table tr').children()[2]).html();

For when I want the cell in the 3rd column as a jQuery wrapped set. Selecting the node using [n] and then passing to $() to get a jQuery wrapped set.

当我想要第三列中的单元格作为jQuery封装集时,使用[n]选择节点,然后传递到$()获取jQuery封装集。

Is there a neater more readable way to do this?

有没有一种更整洁、更容易读懂的方法呢?

1 个解决方案

#1


7

Use the .eq() method

使用.eq()方法

$('table tr').children().eq(2).html();

you could alternatively use the :eq selector

您也可以使用:eq选择器

$('table tr > :eq(2)').html();

更多相关文章

  1. jQuery $ajax 传中文数据到action乱码解决方法
  2. JQuery 的选取元素 和 方法
  3. jquery的function方法中each循环里面判断失败跳出function方法
  4. jQuery.zTree 点击节点展开折叠子节点
  5. js/jquery常用方法------复制粘贴至剪切板
  6. Jquery ready和window.onload方法区别
  7. jQuery -> 获取后代元素的三种方法
  8. jquery手指触摸滑动放大图片的方法(比较靠谱的方法)
  9. jquery 阻止表单提交方法

随机推荐

  1. 值得一看!高级PHP工程师必备的编码技巧及
  2. 实例讲解php提交表单关闭layer弹窗iframe
  3. 控制反转原则,它和依赖注入有什么联系
  4. 教你使用mixphp打造多进程异步邮件发送
  5. 分析ThinkPHP防止重复提交表单的方法实例
  6. 总结PHP实现提取多维数组指定一列的方法
  7. 【记录】PHP-fpm占CPU 100%修复
  8. PHP实现图片防盗链破解操作方法【解决图
  9. 总结PHP字符串与数组处理函数用法
  10. 详解之二:PHP与Web页面的交互示例