I have a form that creates inputs in a table row. I have now added a remove button at the end of the tr which removes that tr when clicked. I also have another function that adds to the rowspan of the first 3 td. When I remove the tr I also want to decrease the rowspan value of those first three td. Currently it only decreases that value on the first tr removal.
I also want to write in an if statement that will prevent the last tr present from being removed. Basically I always want at least one tr to be displayed.
The fiddle is here, http://jsfiddle.net/clintongreen/hmBf8/
I ended up checking the .length() of tds and controlling whether or not the tr could be removed or not. Then another problem arose with the first generated tr, I wanted this to never be deleted so I added a class to it and used .not() so it would not be targeted by my script.
The updated fiddle is here, http://jsfiddle.net/clintongreen/hmBf8/6/