Reputation: 5761
I want to say else if (delete_box is clicked) how can I do that in the else if (currently empty)? They both (man and delete_box) have the same purpose but if you click on one or the other then something slightly different happens.
$(man).add(delete_box).click(function(){
if(App.manager != true){
overlay.fadeIn('fast',function(){
box_2.animate({'top':'200px'},500);
$('#manager_pass').submit(function(evt){
evt.preventDefault();
data = {
managerPassword: $('#token').attr('value'),
action: 'passwordManager'
};
App.manager = $('#token').attr('value'); // set the manager token to the one inserted so that it's stored inside the page
$.ajax({
url: App.URL_manager,
data : data,
dataType: 'json',
type: 'POST',
success: function(r){
if (r.success) {
box_2.animate({'top':'-250px'},500,function(){
overlay.fadeOut('fast');
});
$('.action_wrapper').fadeOut(1000,function(){
$('.add_staff').fadeIn(1000);
})
}
else {
$('#manager_pass').fadeOut(1000,function(){
$('.error').fadeIn(1000);
})
}
}
});
});
});
}
else if()
else{
action_wrapper.fadeOut(1000, function(){
$('#add_staff').fadeIn(1000);
})
}
});
Upvotes: 1
Views: 1836
Reputation: 144709
You can use is
method.
$(man).add(delete_box).click(function(event){
// ...
else if ($(event.target).is(delete_box)) {
// ...
}
})
Upvotes: 1