I am using a command button from JSF. I don't know why I can't call my javascript function. NO alert will show when I click the button.
<h:commandButton id="login" value="Login" action="login"
onclick="return checkPasswords();" type="Submit" />
My Javascript function:
function checkPasswords() {
alert("test");
return false;
}
<input type="button">
Otherwise, it should work - I have exactly the same piece of code in my current codebase that works perfectly.
This is working
Give s in lowercase in type="submit", The type attribute sets the type of button to create for this component. The valid values for this attribute are "submit" and "reset". The default value for this attribute is "submit".