Dear Paul,
As of my knowledge in javascript I feel it can be done on submit which is easier rite. I know in javascript you can run through a for loop and check for each row and check the first row and last row. I know how to do it in javascript but jquery is where I am stuck as I would like to learn it and that is where I am stuck.