jQuery获取table动态的某行的值
发布网友
发布时间:2022-04-26 20:07
我来回答
共3个回答
热心网友
时间:2022-04-24 10:55
既然是获取TD的值 那就加入td的id为tdv 它的值就为$("#tdv").text();
热心网友
时间:2022-04-24 12:13
给tr一个id为aaa,
var str="";
$("#aaa").children("td").each(function(){
str+=$(this).text()+",";
});
alert(str);
热心网友
时间:2022-04-24 13:47
代码如下,你自己试验一下。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>getSelectedTDsContents</title>
<script type="text/javascript" language="JavaScript" src="../script/jquery-1.2.6.js"></script>
<script type="text/javascript" language="JavaScript">
var $j = jQuery;
<!--
function getSelectedTDs(o) {
var tds = $j(o.parentNode.parentNode);
var contents = tds.find("td");
var contentText = "";
for(var i = 0, j = contents.size();i<j;i++) {
if(i!=0)
contentText +=" "+ contents[i].innerHTML;
}
alert(contentText);
}
//-->
</script>
</head>
<body>
<table border="1">
<tr>
<td>
<a href="####" onclick="getSelectedTDs(this);void(0);" >get Selected TDs Content</a>
</td>
<td id="fdTypeId">fdTypeId</td>
<td id="fsDdate">fsDdate</td>
<td id="ctId">ctId</td>
<td id="llType">llType</td>
<td id="fsMgr">fsMgr</td>
<td id="fpPid">fpPid</td>
<td id="fmCode">fmCode</td>
<td id="fmSmt">fmSmt</td>
<td id="fsShould">fsShould</td>
<td id="frRate">frRate</td>
<td id="frRmb">frRmb</td>
<td id="fckName">fckName</td>
<td id="fgName">fgName</td>
<td id="edName">edName</td>
<td id="fsRemark">fsRemark</td>
</tr>
</table>
</body>
</html>