I have a page that displays search results and has a DOM like the following:
div.mcoupdisplay
div.mcoup //search result 1
div.lcoup
div.rcoup
div.rcoupmeta
a.rcoupedit
a.rcoupdelete
div.updcoup
div.delcoup
div.mcoup //search result 2
div.lcoup
div.rcoup
div.rcoupmeta
a.rcoupedit
a.rcoupdelete
div.updcoup
div.delcoup
I currently hide all div.updcoup and div.delcoup and add slideToggle functionality with the following jQuery:
$('div.delcoup').hide();
$('a.rcoupdelete').click(function() {
$(this).closest('div.mcoup').find('div.delcoup').slideToggle(400);
$('div.updcoup').slideUp(400);
$('div.crecoup').slideUp(400);
return false;
});
$('div.updcoup').hide();
$('a.rcoupedit').click(function() {
$(this).closest('div.mcoup').find('div.updcoup').slideToggle(400);
$('div.delcoup').slideUp(400);
$('div.crecoup').slideUp(400);
return false;
});
Say div.updcoup is toggled in search result 1, then I toggle div.updcoup in search result 2. How can I slideUp the visible div.updcoup search result 1 when I toggle the div.updcoup in search result 2?