title: Can I call an exist javascript function into jquery function
body: <p>Can I make a jQuery function that can call an existing Javascript function. But, that Javascript function are from different file.</p>
  
  <p>First I have a button that will open modal dialog that contain a form.Before the form popup I want to check the validation first by using a function that already exist.</p>
  
  <pre><code>&lt;body&gt;
  &lt;input type="button" name="buttonform" id="buttonform" value="Open Modal Form" /&gt;
  &lt;div id="dialogform"  align = "center"&gt;
     DIALOG
  &lt;form name="myForm2" action="/action_page.php" onsubmit="return validateForm()" method="post"&gt;
   Name: &lt;input type="text" name="fname"&gt;
  &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  &lt;/div&gt;   
  &lt;/body&gt;
  </code></pre>
  
  <p>jQuery function:</p>
  
  <pre><code>&lt;script&gt;
  $(function openform(){
  
  $("#dialogform").dialog({
      modal: true,
      autoOpen: false,
      title: "Modal Form",
      width: 700,
      height: 400,
  });
  
  $('#buttonform').click(function (){
  
          $('#functioncheckheader')//function to call from other javascript file
          $('#dialogform').dialog('open');     
  });
  })
  &lt;/script&gt;
  </code></pre>
  
  <p>Example of javascript function from different file:</p>
  
  <pre><code>function checkheader(){
  
  if($('#company').val() == 'select')
  {   alert("Please select the date in header");     }
  else if($('#project').val() == 'select')
  {   alert("Please select the project in header");       }
  else if($('#reqType').val() == 'select')
  {   alert("Please select the request type");       }
  else if($('#la').val() == "")
  {   alert("Please fill up the LA no.");      }
  else if($('#workScope').val() == "")
  {   alert("Please select the work scope.");     }
  
  }
  </code></pre>
  
  <p>BTW,I am new in jQuery. Thank you !!</p>