How to call jquery code in js file from html file

employeeform.html

Employee Information

Employee Information

First Name:
Surname:
Gender: Male Female
Title: Mr Mrs Miss Dr Prof
ID No.:
Mobile Number:
Email Address:
Address:
Location: Sebokeng Sharpville Evaton Boipatong Bophelong Vanderbijlpark Vereeneging
Postal Code:
   

EmployeeModuleBase.js
jQuery().ready(function ()
{
$(’#employeeInfoForm’).submit(function()
{
var postForm = true;
$(’:input’).each(function(index)
{
if ( $(this).val() == “” )
{
if ($(this).attr(“id”)!=“EmailAddress”)
{
$(’#validatortxt_’ + (index + 1).toString()).text(" *");
}

            postForm = false;
          }
          else
          {
            $('#validatortxt_' + (index + 1).toString()).text("");
            postForm = true;
          }
    });
    
    return postForm;
  });

};

what m trying to achieve is to make jquery code from external js file to be executed when the form is submitted, the jquery code validates the html form,it returns true if all required fields are inserted and false if they are not.I can’t seem to make the two file to work in snyc.please help!

you want .js to be added after user submits valid form ?

Sponsor our Newsletter | Privacy Policy | Terms of Service