I am calling a function on button click like this:
function outer() { alert(\"hi\"
You are not calling the function inner, just defining it.
inner
function outer() { function inner() { alert("hi"); } inner(); //Call the inner function }