js-新手求助关于根据选中的radio而获取同一行里面的所有td的值

问题描述

新手求助关于根据选中的radio而获取同一行里面的所有td的值

求教,想根据选中的radio来获取该radio所在那一行里面的所有的td值(每个td里面的值要分别获取出来)
该怎么做呢?

 <c:forEach items="${logoutAccountForm.accountList}"
                                var="logoutList">
                                <tr height="55" class="table_centent_bj_color_b" >
                                    <td width="100" class=""><span class="radio_wrap">
                                            <input type="radio" id="xh" name="xh" value="" /> <label
                                            for="xh" class="check"></label>
                                    </span></td>
                                    <td width="350" class="" id="accNo"><p>${logoutList.accNo}
                                        </p></td>
                                    <td width="200" class="" id="custName"><p>${logoutList.customer.custName}
                                        </p></td>
                                    <td width="300" class="" id="openBank"><p>${logoutList.openbank}
                                        </p></td>
                                    <td width="250" class="" id="openDate"><p>${logoutList.openDate}
                                        </p></td>
                                </tr>
                            </c:forEach>

解决方案

通多dom关系来获取

     $('input[name="xh"]:checked').each(function () {
        var tr = $(this).closest('tr'), tds = tr.find('td');
        alert(tds.eq(1).text())
        alert(tds.eq(2).text())
        alert(tds.eq(4).text())
        //.....
    });

解决方案二:

$(obj).parent("tr").find("td"); 这就是 选中的 radio 对象 获取 父 tr 之后找 tr内部的所有td了

解决方案三:

js 获取radio的选中值 和checkbox 的选中值

解决方案四:

给你的p标签加个id,用js或者jquery一个个取不就行了么

时间: 2024-08-30 11:16:02

js-新手求助关于根据选中的radio而获取同一行里面的所有td的值的相关文章

node js-#node.js新手求求助。。

问题描述 #node.js新手求求助.. #node.js新手求求助.. 刚刚接触node.js,但是刚开始就遇到问题..node.js安装在了d盘,本打算测试一下,在E盘建了个文件夹,然后里边有个hello.js,但是就出了个这么个问题如图,看别的帖子好像说是相对路径绝对路径的问题,但是我真心不懂node.js对路径有什么用规则,所以求好心人告诉一下.. 解决方案 要看你的脚本了,看上去是标识符没有定义. 解决方案二: 这个不是nodejs的问题吧,Unexpected identifier

前端开发-新手求助,我写的js侧边栏上下滑动固定效果,为什么我的一直上下抖动

问题描述 新手求助,我写的js侧边栏上下滑动固定效果,为什么我的一直上下抖动 鼠标滚动得快的时候就出现问题,怎么解决啊? <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> body{ height: 2500px; } #Div{ backgroun

用js代码改变单选框选中状态的简单实例

 这篇文章主要介绍了js代码改变单选框选中状态的简单实例,有需要的朋友可以参考一下 今天突然有一个需求要用到,使用js代码改变单选框的选中状态.当时想也不想直接 代码如下: function doGender(gender) { if (gender == "男") { gel("radionan").style.checked = "checked"; } else { gel("radionv").style.checke

数据-新手求助myflow的问题

问题描述 新手求助myflow的问题 使用myflow画流程图后,点击保存得到的是一个json格式的数据,我要怎样将json数据传递到后台,并生成流程图文件啊 解决方案 后台生成流程图是什么意思?保存为图片?如果是这样你传递容器的innerHTML放到服务器,myflow用的svg或者vml(IE8-)绘图,自己找下使用的语言如何将svg或者vml转为图片保存 如果只是服务器端保存json配置字符串,后台读出来赋值给js变量,然后调用api就可以初始化myflow了,配置为那个js变量 解决方案

急急急!新手求助!!!easyui弹出对话框问题

问题描述 新手求助!!!!前台html:<divclass="main_tab"><ul><liclass="hov">景区列表</li><listyle="cursor:pointer;">添加景区</li></ul></div>js:function(){$(".main_tab>ul>li:eq(1)").clic

java AS新手求助。以下是代码:

问题描述 java AS新手求助.以下是代码: setOnCheckedChangeListener方法参数类型不匹配 ackage gke_code_jrxd.Demo.ui; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; import

PHP页面输出时js设置input框的选中值_php实例

关于php页面输出时js设置input框的选中值的代码如下所示: /* 设置表单的值 */ function setValue(name, value) { var first = name.substr(0, 1), input, i = 0, val; if (value === "") return; if ("#" === first || "." === first) { input = $(name); } else { input

js 选中radiobutton 拉菜单 复选框 下拉列 单选按钮 值

js 选中radiobutton 拉菜单 复选框 下拉列 单选按钮 值 //选中radiobutton的某个值 function ChooseRadioValue(radioName,Value) {     var radio = document.getElementsByName(radioName);     for(var i = 0;i < radio.length;i++)     {         if(radio[i].value == Value)            

PHP页面输出时js设置input框的选中值

关于php页面输出时js设置input框的选中值的代码如下所示: /* 设置表单的值 */ function setValue(name, value) { var first = name.substr(0, 1), input, i = 0, val; if (value === "") return; if ("#" === first || "." === first) { input = $(name); } else { input