【发布时间】:2016-01-14 07:04:03
【问题描述】:
【问题讨论】:
-
看看 jquery 如何访问 td 文本。如果您在
Assing上有一个事件处理程序,那么它将类似于 $(this).closest('tr').find('td:nth-child(3)` 或类似的东西
标签: javascript java ajax
【问题讨论】:
Assing 上有一个事件处理程序,那么它将类似于 $(this).closest('tr').find('td:nth-child(3)` 或类似的东西
标签: javascript java ajax
一个纯 JS 函数可以是(一步一步):
function getDataTable(theButton){
...
var theTD = theButton.parentNode;
var theTR = theTD.parentNode;
var brothers = theTR.childNodes; /* Including the button's td.*/
/* Select a cell, counting from 1 to N.*/
brothers[/*the td-index you want*/].innerHTML = /* the value you want to set.*/
brothers[/*the td-index you want*/].innerHTML; /* or simply get the value it already have.*/
...
/*your AJAX code*/
}
您的按钮应如下所示:
<button onclick="getDataTable(this);">Get data</button>
【讨论】: