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
<script type="text/javascript">
function checkPasswords() {
alert("test");
return false;
}
</script>
<h:commandButton id="login" value="Login" action="login"
onclick="checkPasswords();" type="submit"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With