簡體   English   中英

根據下拉列表的選擇創建表行

[英]creating the table rows based on the selection of the dropdown lists

我需要一個代碼,該代碼根據下拉列表的選擇為我創建表行。例如,如果我選擇3行,那么我需要創建3行。我能夠動態創建行,但可以更改ddl值我無法刪除正在創建的先前行。如何使用jquery或java腳本實現這一點。

謝謝薩加爾。

因此,您只想從表中刪除行,然后向其中添加X行?

您想要的是jQuery remove方法:

// Get the table and delete the rows
var $table = $("#tableId");
$table.find("tr").remove();

// Get the row count and create the number of rows
var rowCount = GetYourRowCount();
for (var i = 0; i < rowCount; i++)
{
    var $tr = $("<tr>");
    $table.append($tr);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM