Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pressing two button in jquery will display this action

I'm basically creating a filter button. If I press button1 {this will happen} If press button2 {this will happen}

but if I press button1 and then button2 {this has to happen}

This is the code I have so far. Thanks!

$(document).ready(function() {
       if($('#button1').click(function() &&   $('#button2').click(function()){
           //perform actions

    });
like image 942
Charles Xavier Avatar asked Oct 20 '25 07:10

Charles Xavier


1 Answers

Here is the logic

button 1 handler {
    set var to indicate click
    do what you need
}

button 2 handler {
    check var  to see if button 1 is clicked
    do whatever you need based on the var check
}

This only handles button 1 click followed by 2, but you get the idea and should be able to figure out if button 2 is clicked then 1

like image 50
Huangism Avatar answered Oct 22 '25 21:10

Huangism



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!