Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
101
rated 0 times [  108] [ 7]  / answers: 1 / hits: 100803  / 13 Years ago, thu, october 6, 2011, 12:00:00

Is there a way to check if a next element exists? Check my code:


if($("#people .making-of .mask ul li.current").next("li") != null) {
alert("Exists");
}
else {
alert("Dont exists");
}

What am I doing wrong? Thanks a lot!


More From » jquery

 Answers
52

Have you tried looking at .next('li').length?


[#89751] Wednesday, October 5, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
analiseg

Total Points: 460
Total Questions: 96
Total Answers: 90

Location: Ecuador
Member since Thu, Jun 4, 2020
4 Years ago
;