Im trying to get the value of the previous row in a table.
The row is selected by adding the .selected class to the row, then when the #btnIncrement is pressed, I need to find the previous rows value from the .selected row.
I thought I could use:-
upperIncrement = $(".selected").parents("tr");
Which I thought would look at all the rows with the current row as current, then using the prev() can look at the previous row, and pull the data attribute out, but it doesnt work.
I know this isnt going to work for the first row, but when it comes to looking into this, I can always say if its the first row then not to even run it.
Any ideas how I can find the previous rows data attribute from the currently selected row?
Ive uploaded the code to a jsFiddle in the hope someone can help :-S
Thank you in advance.