Search code examples
javascriptjqueryvalidationformvalidation.io

Run the function of javascript in one time


Hi I have everything fine but little problem is this that functions is running one by one. I want all functions must run at one time here is the code I am using

<form id="payForm" action="address-to-be-licensed.html" method="post" novalidate="novalidate" onsubmit="return (fnamevalidaton() && emailvalidate() && lastnamevalidation())">

Solution

  • This will help

    <form id="payForm" action="address-to-be-licensed.html" method="post" novalidate="novalidate" onsubmit="return validate()">
    
    <script>
        function validate() {
            var fname = fnamevalidaton();
            var email = emailvalidate();
            var lastname = lastnamevalidation();
    
            return fname && email && lastname;
        }
    </script>