I have a problem with the this
element (I know how this
is working).
I have a lot of that html structure. When I click on the a button, the
You should use jQuery.parent()
and jQuery.next()
to get this done.
Check out the sample and this jSFiddle Demonstration.
Html
jQuery
$(".button").click(function () {
var div = $(this).parent().next();
if(div.is(":visible")) {
div.hide();
} else {
div.fadeIn(450);
};
});