开发者

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

开发者 https://www.devze.com 2023-01-12 22:03 出处:网络
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

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

精彩评论

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

关注公众号