Advertisement
Guest User

Untitled

a guest
May 25th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. $(document).ready(function(){
  2. var $btn1 = $("#btn1");
  3. var $btn2 = $("#btn2");
  4. var active1 = true;
  5. var active2 = false;
  6.  
  7. $btn1.click(function(){
  8. $active1 = false;
  9. $active2 = true;
  10. alert("after btn1 click: --> " + " active1: " + active1 + ", active2: " + active2);
  11. });
  12.  
  13. $btn2.click(function(){
  14. // If clicked first on btn1 I'm expecting active1=false; active2=true; ??
  15. alert("after btn2 click: " + " active1: " + active1 + ", active2: " + active2);
  16. });
  17. });
  18.  
  19. <button id="btn1">Button1</button>
  20. <button id="btn2">Button2</button>
  21.  
  22. $btn1.click(function(){
  23. active1 = false;
  24. active2 = true;
  25. alert("after btn1 click: --> " + " active1: " + active1 + ", active2: " + active2);
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement