jQuery:在div中设置表格单元格的值

时间:2022-06-19 22:23:59

I have a floating div which contains a title and I want to change that title. I tried this:

我有一个包含标题的浮动div,我想要更改该标题。我试过这个:

$("div#dragTitle3").text("New Title");

But the title is actually in a table inside the div. This is the table:

但标题实际上是在div内的表格中。这是表:

<table><tbody><tr><td>Announcements</td><td style="text-align:right"><img src="buttontop.png" class="divTitleButton" id="dragButton3" onmousedown="javascript:toggleContentWin(3)"></td></tr></tbody></table>

I want to know how I can change the title without entering the whole table's code when I set the new table.

我想知道在设置新表时如何在不输入整个表的代码的情况下更改标题。

1 个解决方案

#1


This should work:

这应该工作:

$("div#dragTitle3 td:first").text("New title")

#1


This should work:

这应该工作:

$("div#dragTitle3 td:first").text("New title")