Why is this Javascript code executed twice? -


when link clicked on site javascript code below executed, if condition true display alert dialog. when user selects ok button in alert dialog block of code executed again.

so alert closes, code below executed second time , alert dialog displayed again. when used selects ok button on alert dialog second time alert dialog closed good.

how can prevent code below being executed twice?

$("#my-button").click(function() {     var login = somevar;     if(!somevar || somevar == ''){         $('.close-reveal-modal').click();          alert(mymessage);     } }); 

check if adding click handler twice, maybe causing behavior.

in case remove 1 of them.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -