i have a weird problem ,so after i changed the id of all table rows after delete one row. here is a part of my code :
$(document).on("click",".fa-trash-alt",function(){ console.log($(this).attr("id")) let index = parseInt($(this).attr("id")) globalFunctions.removeFromChoosedList(index) $('tr#'+index).remove() let rows = $(".choosed-table-data tr") $.each(rows,function(index,value){ $(value).attr("id",index) }) }) The problem is that after this operation when i click on a row that should have a new id , the old id appears with console.log($(this).attr("id")) despite the id is changed on inspector
https://stackoverflow.com/questions/67064587/why-this-attrid-get-the-old-attribute-after-change-it-with-javascript April 13, 2021 at 03:32AM
没有评论:
发表评论