Beginners question - how to get .closest() working? Any jQuery Blackbelts here?
I have quite a few links or input buttons on my page which should toggle one of two folders: .negative and .postive
However, whilst the code below works, when I click a .posHide button it toggles ALL the .positive and .negative DIV's. I've tried using .closest() to get this to work but can't. Can any jQuery blackbelt explain to me how I change the code below so that each instance of .posHide only toggles the nearest .positive and .negative divs?
- // toggle error messages
$(function() {
$('a.posHide,input.posHide').click(function() {
$('.positive').slideToggle('slow');
$('.negative').slideToggle('slow');
return false;
});
});