Skip to content
Advertisement

i have to call two button click events add and remove from jquery tabs,i’m using jquery forms

this is my code with add and remove buttons on a table inside a jquery tab, but when i call click event it is not calling it.

JavaScript

i have added my code above, i need this add and submit button to work from jquery tabs, also these textbox values need to be saved as records, how can i identify each row when i add or remove a row from table

Advertisement

Answer

In below code i have use .length to get the length of row and added 1 for displaying S.no count because count starts from 1. Then,instead of looping through all inputs i have just use .find("input").val("") to empty all inputs values and then finally use appendTo to append tr particular table only.

Then, when user will click on remove button i have get the id of table which will be unique in all tabs and then i have passed this value to the function resetValues to reset the S.no column count onces any row gets removed. So , using table id i have loop through tbody tr and have reset the counts .

Demo Code :

JavaScript
JavaScript

Note : Above code will work on any table only you need to make sure id is unique for all tables .

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement