Re cursive Jquery function exceeding maximum callstack

[quote=“damiano, post:3, topic:231682, full:true”]
Just to understand this properly, the programm knows what this is when declared, but when you just say “li” instead it gets confused because there is no proper reference?[/quote]

That’s right. Using “li” means that it gets all LI elements on the page.

Sorry, it doesn’t work that way.

It gives you an array-like structure of all the matching HTML elements on the page.

The this keyword can easily become very confusing, so it can really help to assign it to a variable so that you know what is happening there.

For example:

function hideNext(){
  var li = this;
  $(li).prev().hide('fast', hideNext)
}