I am running a chrome extension that has an input from the user in a prompt(), this will then run through a few functions and should ultimately run a confirm().
However, when I am doing this everything is working fine, but I am then getting the following on the confirm():
Uncaught TypeError: undefined is not a function
This is only happening once I click on the Chrome Extension, before I click on it confirm() works correctly :/
function resetPassword(id, name, email) {
var confirm = confirm("Please confirm the Password rest of '" + name + "' (" + email + ")");
if (confirm == true) {
/* Checks the user and marks them as deactivated */
var password = sforce.connection.resetPassword(id);
} else alert("Password Reset Cancelled!");
}
I am VERY confused here… I have only been using .js for a few months so I am baffled!
Best Answer
Change you code to e.g.:
Your local variable is hiding (shadowing) the function because it has the same name.