1、问题描述

点击 table 中的某行 tr,获取该 tr 下的第一个 td 标签下的< input type="hidden" value="92"/>(隐藏域)的 value 值,即获取 92。

HTML代码

 <table class="layui-table" id="alertTable" style="margin: 0 auto; width: 100%;">
<thead>
<tr>
<th>日期</th>
<th>经度</th>
<th>纬度</th>
<th>距离</th>
</tr>
</thead>
<tbody>
<tr class="alertChart">
<td>
<input type="hidden" value="92" /> 2017-06-01 </td>
<td>110.23568</td>
<td>125.23564</td>
<td>25.2m</td>
</tr>
</tbody>
</table>

2、解决方案

js代码(jQuery操作)

 $('.alertChart').dblclick(function(){
alert( $(this).children('td').eq(0).children('input').val() ) ;
});

正确输出

3、笔记

① parent和parents的区别

parent()是找当前元素的第一个父节点,不管匹不匹配都不继续往下找

parents()是找当前元素的所有父节点 

 child和childern的区别

child()是找当前元素的第一个子节点,不管匹不匹配都不继续往下找

childern()是找当前元素的所有子节点 

jQuery 选中tr下面的第某个td的更多相关文章

  1. jquery 对table的一些操作 怎么获取tr下的第二个td元素?

    1.HTML结构 <table id = "test"> <tr><td>1</td><td>1</td>& ...

  2. jquery获取tr并更改tr内容

    jquery获取tr并更改tr内容示例代码. 例子: $(document).ready(function() { $("#Email tr").each(function(){ ...

  3. jquery选中radio或checkbox的正确姿势

    jquery选中radio或checkbox的正确姿势 Intro 前几天突然遇到一个问题,没有任何征兆的..,jquery 选中radio button单选框时,一直没有办法选中,后来查了许多资料, ...

  4. jQuery table tr隔行变色,鼠标移入移出变色,鼠标点击变色

    .trover { background: #f9f9f9; } .trclick { background: #c4e8f5; } .treven{ background:#CCFFCC; } .t ...

  5. jquery选中checkbox

    jquery选中checkbox: $(function(){ $("[value = bb]:checkbox").attr("checked", true) ...

  6. jquery从tr获取td

    已知HTML:<tr id="row001"><td>001</td><td>张三</td></tr>JQU ...

  7. Jquery选中行实现行中的Checkbox的选中与取消选中

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs& ...

  8. jQuery控制TR的显示隐藏

    网上有很多,这里介绍三种: 第一种方法,就是使用id,这个方法可以在生成html的时候动态设置tr的id,也是用得最多最简单的一种,如下: <table> <tr><td ...

  9. JQuery 选中Radio

    <tr> <td> <input type="radio" name="rdb" value="启用" che ...

随机推荐

  1. Vika and Segments - CF610D

    Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-d ...

  2. 【刷题】BZOJ 4830 [Hnoi2017]抛硬币

    Description 小A和小B是一对好朋友,他们经常一起愉快的玩耍.最近小B沉迷于**师手游,天天刷本,根本无心搞学习.但是已经入坑了几个月,却一次都没有抽到SSR,让他非常怀疑人生.勤勉的小A为 ...

  3. Linux相关——关于gdb的checkpoint & breakpoints指令

    1,checkpoint ,,,这个指令简直,,,相见恨晚啊,居然现在才发现,.. 好吧来介绍一下这个指令:checkpoint(检查点) 我们调试程序,常常会出现好不容易发现了错误,却已经跑完那个地 ...

  4. BZOJ1090:[SCOI2003]字符串折叠——题解

    http://www.lydsy.com/JudgeOnline/problem.php?id=1090 Description 折叠的定义如下: 1. 一个字符串可以看成它自身的折叠.记作S=S 2 ...

  5. SPOJ3267/DQUERY:D-query——题解

    https://vjudge.net/problem/SPOJ-DQUERY http://www.spoj.com/problems/DQUERY/en/ 给定一列数,查询给定区间内数的种类数. 这 ...

  6. POJ 2774 求两个串的最长公共前缀 | 后缀数组

    #include<cstdio> #include<algorithm> #include<cstring> #define N 200005 using name ...

  7. 函数strcpy的实现

    strcpy函数的百科中给出了各种情况的详细说明,这里,仅给出一些注意事项: 1.strcpy的函数原型是: /* dest(destination)为目标字符串,src(source)为原字符串*/ ...

  8. X day3

    题目 官方题解 T1: 一道水题 #include<iostream> #include<cstring> #include<cstdio> #include< ...

  9. centos7安装uwsgi报错

    错误为: [root@bogon ~]# pip install uwsgi Collecting uwsgi Using cached uwsgi-.tar.gz Installing collec ...

  10. 【题解】ZJOI2009 假期的宿舍 网络流 最大流

    好久没有来写博客啦,来水一发. 网络流建模首先很容易想到,如果一个人能睡一张床,那么在这个人和这张床之间连接一条容量为1的边从s向每个需要住宿的人连容量为1的边,表示这个人需要住宿从每张床向t连容量为 ...