jQuery,在表中设置td的值? [英] Jquery, set value of td in a table?

查看:308
本文介绍了jQuery,在表中设置td的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用<tr><td>标签动态创建一个表. td标签之一获取ID为"detailInfo".我在某些按钮上具有onclick函数.按下按钮后,我想在td"detailInfo"中设置一些值.

I create dynamic a table with <tr> and <td> tags. One of the td tags gets the id "detailInfo". I have an onclick function on some button. I would like to set some value in the td "detailInfo" after pressing on the button.

那么我该如何设置id为"detailInfo"的td的值?

So how can I set the value of the td with id "detailInfo" ?

这是td:

<td id="detailInfo" rowspan="2" width="300px">picture detail</td>

推荐答案

使用.html()和选择器来获取/设置HTML:

use .html() along with selector to get/set HTML:

 $('#detailInfo').html('changed value');

这篇关于jQuery,在表中设置td的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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