In the example below, myFonk is called instantly; it doesn\'t wait for the click event. Why not?
function myFonk(info) {
$(\"#result
Whenever we write the function name with () it calls that function instantly
hence
myFonk("myFonk") is not correct way..
Write in following manner.
function myFonk(info) {
$("#result").html(info);
}
function getText(text) {
return function () {
myFonk(text);
}
}
$(document).ready(function () {
$("#b1").click(getText("getText"));
$("#b2").click(function () {
myFonk("myFonk")
});
});