javascript - Add new row onkeyup inside last input field -
imagine have 3 rows in table, there 3 input fields in every row. when type in last input field should add new row following last row when hit backspace , fields in latest row empty new added row should remove
i have no idea how prevent addition if new row appended table. i've done far.
$(document).ready(function(){ $("input[name=class_name\\[\\]]:last-child").keyup(function addnewrow(e){ var parent = $(this).closest('tr'); var tr = parent.clone(); if(e.keycode != 8){ $("#classes tr:last-child").remove(); }else{ $("#classes").append(tr); } }); });
how check selecting last element again, , compare this
? if it's not same, row has been added
Comments
Post a Comment