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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -