javascript - check one button click on another button click -


i have 2 buttons next , add. want user click next after clicking add button. if user don't click on add button , click on next button should alert, click on add button.

conside example

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <body>  <button id="next">next</button>  <button id="add">add</button>  <script>    $(function(){      var addclicked = false;      $('#next').on('click', function(){        // code execute        addclicked = true;        alert('add clicked');      });      $('#add').on('click', function(){        if(addclicked == true){          addclicked = false;          // code execute          }else{          alert('please click next');        }              });    });  </script>  </body>

add button proceed after next button clicked


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

android - Unable to generate FCM token from dynamically instantiated Firebase -