Due to your code:
$("#map").click(myFunc());
is incorrect and should be:
$("#map").click(myFunc);
Your code will call myFunc () first and then mimic the onclick event.
As can be seen from the documentation:
What you did is: (since myFunc returns null)
click ()
, . , . click : $( "" ) ();.
, :
click (fn) . . mousedown mouseup . :