title: How to validate an element is exist in form or not using JS
body: <pre><code>&lt;pre&gt;
  &lt;script&gt;
  // here i want to check form validation
  //if i use for loop txtbox2 is not exist in my form so i am getting Js error
  
  
  //Don't write individual validation
  //check element is exist or not if exist check for validation
  
  //I need know how to check an element is exist or not
  &lt;/script&gt;
  
  &lt;form
  &lt;input type="text" id="txtbox1" name="txtbox1" /&gt;*
  &lt;input type="text" id="txtbox3" name="txtbox3" /&gt;*
  &lt;input type="text" id="txtbox4" name="txtbox4" /&gt;*
  &lt;input type="text" id="txtbox5" name="txtbox5" /&gt;*
  &lt;input type="text" id="txtbox15" name="txtbox15" /&gt;*
  &lt;input type="text" id="txtbox28" name="txtbox28" /&gt;*
  
  &lt;/pre&gt;
  </code></pre>