In this article, you will learn how to return true or false in javascript function
<script type="text/javascript">
$("#btnSubmit").click(function () {
var txtEmail1 = $("#txtEmail").val();
if (txtEmail1 == '') {
txtEmail.focus();
return false;
}
else if (txtPassword1 == '') {
return true;
}
});
</script>
<input type="button" onclick="return func1();" />
function func1()
{
// do something
return false;
}
How to return true or false in javascript function?
minify code