Hi, I am new to jquery, can you please explain to me what this line means : var questionNumber = $(this).parents().eq(2).index(); ? Thanks
Looks to be a complicated way of returning the index of the given matching element. The code assigns a variable (var) named questionNumber - this variable looks for the containing object's ($(this)) parents, finds number 3 (.eq(2) <- zero-based indexing) and returns that items index() - I'm a little unsure as to what this is supposed to do. Have a look here: https://api.jquery.com/eq/ regarding .eq() and here: http://api.jquery.com/index/ regarding .index()