<!doctype html>
<html>
<head>
<script src="jquery.js"></script>
</head>
<body>
<script>
function show1(){
$("#btn").click(show2());
window.alert("1st show");
}
function show2(){
$("#btn").click(show3());
window.alert("2nd show");
}
function show3(){
window.alert("3rd show");
}
</script>
<button id="btn" onclick="show1()">Show</button>
</body>
</html>
I dont understand the behavior of the code above. After setting the $("#btn").click(show2());, the function is executed even though I din't clicked the button. Why?