I am trying to find the next div after an input button and toggle it.
What am I doing wrong?
JS:
$(\".showNextExperience\").click(function() {
Assuming you have elements between triggering input and manipulated div:
Hello, new line
Experience 1
Some text
And an info block
Experience 2
Then you have to use nextAll
to search not only for the very next element but through the whole DOM, which is probably simpler coding than using next().find()
:
$(".showNextExperience").click(function() {
$(this).nextAll(".experience").toggle();
});