I have the following .click()
functions.:
$('.tab').click(function(){
$('.tab').removeClass('activeTab');
$(this).addClass('activeTab');
});
$('.edit').click(function(){
$(this).hide();
$(this).next().show();
});
$('.cancel').click(function(){
$(this).parent().hide();
$(this).parent().prev().show();
});
Is it possible to combine these functions doing something like this?
PSEUDOCODEPseudocode:
$.click(function(){
for $('.tab'){
//do this
}
for $('.edit'){
//do this
}
for $('.cancel'){
//do this
}
});
HTML SNIPPET:
<a href="javascript:void(0);" class="edit">Edit</a>
<span class="controls">
<a href="javascript:void(0);" class="cancel">Cancel</a> |
<a href="javascript:void(0);" class="save">Save</a>
</span>