1

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);

            })
        }


});

1 Answer 1

1

You can use is method.

$(man).add(delete_box).click(function(event){ 
    // ...
    else if ($(event.target).is(delete_box)) {
       // ...
    }
})

http://jsfiddle.net/9gcdQ/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.