开发者

creating the table rows based on the selection of the dropdown lists

I need a code which creates me the table row based on the selection of the dropdown lists.For example if i select 3 then i need 3 rows to be create.I am able to create the rows dynamically but on the change of the ddl value i am not able to delete the previous rows which were getting create开发者_运维知识库d.How can i achieve that using jquery or java script.

Thanks Sagar.


So you just want to remove the rows from the table and then add X amount of rows to it?

What you want is the jQuery remove method:

// 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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜