Let’s understand statement step by step
$("#table_data").find("tr:not(:first)").remove();
$("#table_data")
It finds the table with id (table_data)
$("#table_data").find()
this will find the elements on the basis of selector here as selector is "tr:not(:first)"
so it will find all the tr
except first
one. Finally there is .remove()
that will remove the selected rows.
So the complete statement will remove all the rows except first one