Right now i am successfulling getting the value of an element by doing this:
var id = $(this).parent().parent().parent().parent().attr('id').toString();
However, I am now finding that i am going to have to continue getting values like this and was wondering if there is a more efficient way to look through parent elements for a given element.
Below i tried this, but it does not work:
var id = $(this).parent(4).attr('id').toString(); ???
You should use closest()
so you justneed to specify the id of the element you are lloking and closest() will
EDIT of course if you don’t know the id you can use a class