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. 【刷题】BZOJ 4698 Sdoi2008 Sandy的卡片

    Description Sandy和Sue的热衷于收集干脆面中的卡片.然而,Sue收集卡片是因为卡片上漂亮的人物形象,而Sandy则是为了积攒卡片兑换超炫的人物模型.每一张卡片都由一些数字进行标记,第 ...

  2. BZOJ4869:[SHOI2017]相逢是问候——题解

    http://www.lydsy.com/JudgeOnline/problem.php?id=4869 题面复制于洛谷:https://www.luogu.org/problemnew/show/P ...

  3. 洛谷 P2906 [USACO08OPEN]牛的街区Cow Neighborhoods | Set+并查集

    题目: https://www.luogu.org/problemnew/show/P2906 题解: 垃圾水题 #include<cstdio> #include<algorith ...

  4. Unity3D LOD Group

    今天下了一个4.0破解版,然后看到一个Demo Level of Detail    就研究了一下  以前用的是Unity3.5 free版本,没有这个功能,真实泪奔....... As your s ...

  5. React router 4 获取路由参数,跨页面参数

    1. match通过路径 <Route path="/path/:name" component={example} /> 路由组件内获取参数使用 this.props ...

  6. Codeforces Round #539 (Div. 2) 题解

    Codeforces Round #539 (Div. 2) 题目链接:https://codeforces.com/contest/1113 A. Sasha and His Trip 题意: n个 ...

  7. telnet退出

    windows下退出telnet:可以参考下面linux退出,也可以直接关闭窗口. linux退出telnet: 1.输入ctrl+]:显示出telnet>. 2.此时可以输入?,查看可以使用的 ...

  8. AngularJs 中的CheckBox前后台交互

    前台页面: <div class="form-group"> <label for="CompanyName" class="col ...

  9. 图论:Prufer编码

    BZOJ1211:使用prufer编码解决限定结点度数的树的计数问题 首先学习一下prufer编码是干什么用的 prufer编码可以与无根树形成一一对应的关系 一种无根树就对应了一种prufer编码 ...

  10. windows 安装elk日志系统

    1.前往https://www.elastic.co官网下载对应的elasticsearch .kibana和logstash他们的版本号一致. 2.elasticsearch 解压后前往bin文件下 ...