berrymancp24

toggling function on and off

Discussion created by berrymancp24 on Jun 29, 2012
Latest reply on Jun 29, 2012 by hzhu
I am trying to write a function that will allow me to turn a function off with a checkbox. 

here is my code:

jQuery("#centeronCurrentLocationCheckBox").change(function() {
  if(showLocation == 0){
    showLocation = 1;
   }else{ 
    showLocation = 0;
   alert("hi");
   }   
  }); 


I have another working checkbox that does the same as this, so I thought I would recreate it with just different titles for the function and id name. 

I also created a event handler function for this as well, but when I did, my map did not show up at all and I got an error that was located in the arcgis javascript api.

any suggestions as to how to create the code to turn this function on and off?

Outcomes