title: Get the value of text box using jquery
body: <p>I have the following script  : </p>
  
  <pre><code>&lt;script&gt;
  
      $(document).ready(function() {
  
          $('#edit').click(function (){
              //get
              employee_id = $('#employee_id').val();
              alert(employee_id);
              html='';
  
              $.ajax({
                  type: "GET",
                  url: "&lt;?php echo base_url();?&gt;administrator/admin/get_employee_details/"+employee_id,
                  dataType: "json",
                  success: function(response) {
                      console.log(response);
                      $( '#fname' ).val(response[0].f_name);
                      alert(response[0].amount);
                      $( '#sname' ).val(response[0].l_name);
                      $( '#lname' ).val(response[0].other_name);
                      $( '#expiry_date' ).val(response[0].id_no);
                      $( '#quantity_available').val(response[0].dob)
                      $( '#gender' ).val(response[0].gender);
                      $( '#maritalstatus').val(response[0].marital_status)
                      $( '#sex' ).val(response[0].gender);
                  },
                  error: function(data){
                  }
              })
          });
  
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>The script is supposed pick the employee_id value from the table below : </p>
  
  <pre><code>&lt;tbody&gt;
      &lt;?php foreach($employee_details as $employee ):?&gt;
          &lt;tr class="odd gradeX"&gt;
              &lt;td&gt;&lt;?php echo $employee['employee_name'];?&gt;&lt;/td&gt;
              &lt;td &gt;&lt;?php echo $employee['id_no'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['dob'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['gender'];?&gt;&lt;/td&gt;
              &lt;td &gt;&lt;?php echo $employee['marital_status'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['phone_no'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['email'];?&gt;&lt;/td&gt;
              &lt;td &gt;&lt;?php echo $employee['date_added'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['residence'];?&gt;&lt;/td&gt;
              &lt;td &gt;&lt;?php echo $employee['next_of_kin_name'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['next_of_kin_relation'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['next_of_kin_phone_no'];?&gt;&lt;/td&gt;
              &lt;td &gt;&lt;?php echo $employee['is_active'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['department_name'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $employee['employee_class'];?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a class="edit" href="#edit_details" id="edit"&gt;Edit &lt;/a&gt;&lt;/td&gt;
              &lt;td&gt; &lt;a class="delete" href="#delete_details" id="delete"  &gt; Delete Employee&lt;/a&gt;&lt;/td&gt;
              &lt;input type="text" name="employee_id" id="employee_id" value="&lt;?php echo $employee['employee_id'];?&gt;"/&gt;
          &lt;/tr&gt;
      &lt;?php endforeach;?&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>which is a hidden text field (employee_id) in the table when I click the Edit button. But when I click the link , I get an empty result with no employee_id yet I can see the employee id in the text box. How can I get the employee id from the text box for each specific row? </p>