You can toggle it by using the !
operator
circlePicker.click(function () {
circlePickerSelector = !circlePickerSelector;
console.log(circlePickerSelector);
});
If circlePickerSelector
was originally true
, then !circlePickerSelector
turns it to false
. You can then assign it to the same variable to do the reverse on next click.