I am trying to use jQuery to do something like
if(jQuery('#id').click) {
//do-some-stuff
} else {
//run function2
}
But I’m unsure how to do this using jQuery ? Any help would be greatly appreciated.
Edit: I’m trying to run a function if the #id has been clicked and specifically it is has not been clicked then run the function 2 ? i.e. I need to check firstly that the #id has been clicked before running function2 ?
You should avoid using global vars, and prefer using
.data()So, you’d do:
Then, to check if it was clicked and perform an action:
Hope this helps. Cheers