如何在jquery中读取表的跨度值 [英] How to read span value of table in jquery

查看:78
本文介绍了如何在jquery中读取表的跨度值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这样填表。我想在jquery / javascript中读取span的值



< table> 
< tr>< td>< span id = span1> 0. 00 < / span < span class =code-keyword>> < / td >
< td>< input onchange = display(this)占位符= 0.00 />
< / td >
< / tr >
< / table >

function display(lnk){
var row = lnk.parentNode.parentNode;
alert(row.rowIndex);
alert($(' #row.cells [0]')。text() );
var rowIndex = row.rowIndex - 1 ;
}

解决方案

' #row.cells [0]')文本())。
var rowIndex = row.rowIndex - 1 ;
}


可用于阅读范围



< 。BLOCKQUOTE>( '#spanId')文本();

I fill table like this. I want toread value of span in jquery/javascript

<table>
<tr><td><span id="span1" >0.00</span></td>
<td><input onchange="display(this)" placeholder="0.00" />
</td>
</tr>
</table>

 function display(lnk) {
            var row = lnk.parentNode.parentNode;
            alert(row.rowIndex);
           alert($('#row.cells[0]').text());    
            var rowIndex = row.rowIndex - 1;
        }

解决方案

('#row.cells[0]').text()); var rowIndex = row.rowIndex - 1; }


you can use for read span


('#spanId').text();


这篇关于如何在jquery中读取表的跨度值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆