![](/img/trans.png)
[英]How to get specific parameter in tr tag and td value using javascript
[英]How to clear the specific <td> data of <table> tag using javascript/jquery?
<!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <title></title> </head> <body> <table class="tapshil" id="" border="2px" width="100%"> <thead> <tr> <th> <font face="preeti">l;=g+=</font></th> <th><font face="preeti"> k|=b=g</font></th> <th><font face="preeti"> ldlt</font></th> <th><font face="preeti"> eG;f/ dx;'n tyf hl/jfgf</font> </th> <th><font face="preeti"> cGtMz'Ns</font></th> <th><font face="preeti"> d"=c=s/ </font></th> <th><font face="preeti"> hDdf dx;'n</font> </th> <th><font face="preeti"> hDdf </font> </th> </tr> </thead> <tbody> <!-- put loop here --> <tr> <td>1</td> <td>11 1212231 </td> <td id="nameOfPeople">Arun Lama 2070-01-01 2072-01-01 Amin Shrestha 2070-01-01 2072-01-01 </td> <td>3</td> <td>7</td> <td>11</td> <td>15</td> <td id="totalOfAll">36</td> </tr> </tbody> </table> </body> </html>
我有一個<td id="nameOfPeople"></td>
。我想通過使用其ID清除此特定數據。 因此,我試圖清除數據,但尚未清除。 我嘗試過:
$(".tapshil tbody tr td .nameOfPeople").text('');
我試圖清空的數據,但沒有清除field。如何使其為空?
ID在該表中必須是唯一的
$("#nameOfPeople").text('');
您希望在該位置發生什么? 該表無法重排以填充剩余的空間-這似乎是瀏覽器響應錯誤的秘訣。
考慮隱藏td的內容,而不是td本身。
您可以使用內聯CSS來隱藏它:)
<td style="visibility:hidden"> Your content is hidden </td>
您也可以通過JQuery隱藏它。 使用$(“#td_id”)。hide();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.