title: how to validate datalist field by using jquery validator in php
body: <p>Hi I am working as web application developer, I am stuck in the jquery validation. In my form have to show list employee by using  tag in my form, if the client may be enter the correct name or enter few char and select the employee name from datalist. Suppose the client enter any name (except exist employee name from list), have to validate.</p>
  
  <p>my html code:</p>
  
  <pre><code>&lt;input list="pAdminID" id="pAdminName" name="pAdminName" onchange="GetID()" value="&lt;?php echo $pAdminName; ?&gt;"&gt;
  &lt;datalist name="pAdminID" id="pAdminID"&gt;
  &lt;?php foreach($emp as $row) { ?&gt;
  &lt;option id="&lt;?php echo $row['emp_id']; ?&gt;" value="&lt;?php echo $row['emp_name']; ?&gt;"&gt;&lt;?php } ?&gt;
  &lt;/datalist&gt;
  &lt;input type="hidden" id="empID" name="empID"&gt;
  </code></pre>
  
  <p>my script :
  to get employee id</p>
  
  <pre><code>function GetID() {  
      var x = $('#pAdminName').val();
      var z = $('#pAdminID');
      var val = $(z).find('option[value="' + x + '"]');
      var empID = document.getElementById('empID');
      empID.value  = val.attr('id');
  }
  </code></pre>
  
  <p>to validation:</p>
  
  <pre><code>$(function() {
  
      $("#project").validate({
  
      rules: {
          pName: "required",
          pAdminName: "required"
      },     
  
      messages: {
          pName: "Please enter the Project Name",
          pAdminName: "Please enter or select the Assignment name"
      }
  });
  });
  </code></pre>
  
  <p>please help how to validate the pAdminName field?</p>