I have the following code that controls the presentation of an interdependent group. The current code works, I'm wondering if there is a way to streamline the code so less is duplicated.
$('div.locUpd').hide();
$('div.locDel').hide();
$('div.addLocation').hide();
$('a.edit').click(function(){
$(this).parent().nextAll('div.locUpd').slideToggle(400);
$('div.locDel').slideUp(400);
$('div.addLocation').slideUp(400);
return false;
});
$('a.del').click(function(){
$(this).parent().nextAll('div.locDel').slideToggle(400);
$('div.locUpd').slideUp(400);
$('div.addLocation').slideUp(400);
return false;
});
$('p.buslocadd').click(function(){
$(this).prev('div.addLocation').slideToggle(400);
$('div.locUpd').slideUp(400);
$('div.locDel').slideUp(400);
return false;
});
Is there a more efficient way to write this?
Edit----------------
Here's the HTML structure:
div.mbuslocations
div.location
span.lmeta
a.edit
a.del
div.locUpd
div.locDel
div.addLocation
p.buslocadd