title: How to get value of dropdown list from dynamic array?
body: <p>I have dynamic table, in that table every row has a dynamic dropdown list. So every dynamic dropdown list have a unique id, I have to pass this <code>id</code> to the <code>onChange</code> function. And from this onChange function I have get the value of selected dropdown list. Please see <a href="https://stackoverflow.com/questions/28541298/how-to-add-drop-down-list-in-every-row-of-dynamic-table-which-fetch-data-from-se">this</a> question for more info.</p>
  
  <p>ByDefault every job is New Job. If I change the dropdrown list from new Job to close job, then I have to change the status of job new to close job in data base and refresh table, that row will be not in table which change from new to close job, So How I will do using even delegation</p>
  
  <p>I am able to get the id of dropdown list But when I use <strong><code>var value=$('#id').va;</code></strong> It gives undefined. So how to get the value of selected drop down list. </p>
  
  <p><img src="https://i.stack.imgur.com/ZMhl4.png" alt="check dynamic table">,</p>
  
  <p><strong>Java Script</strong></p>
  
  <pre><code>&lt;script&gt;
          function fetchData1(){                           
              $(".data-contacts1-js tbody").empty();
                 $.get("http://localhost/service/Services.php", function(data) {
                 var obj=JSON.parse(data);                   
                 for(var i in data){
                   var tr=$("&lt;tr&gt;&lt;/tr&gt;");
                   tr.append(
                          "&lt;td&gt;" + obj[i].b_id + "&lt;/td&gt;" +
                          "&lt;td&gt;" + obj[i].cust_name + "&lt;/td&gt;" +                           
                          "&lt;td&gt;" + obj[i].cust_mobile + "&lt;/td&gt;" +                           
                          "&lt;td&gt;" + obj[i].cust_email + "&lt;/td&gt;");
                           tr.append(
                           "&lt;select  id="+obj[i].b_id+" class='input-small'&gt;&lt;option value="+1+"&gt;New Job&lt;/option&gt;&lt;option value="+2+"&gt;WIP Job&lt;/option&gt;&lt;option value="+3+"&gt;Close Job&lt;/option&gt;&lt;/select&gt;");
                           $(".data-contacts1-js tbody").append(tr);
                           i++;
                 }
              });
          }  
  
          $(document).ready(function(){
                $(".data-contacts1-js tbody").empty();
                $('.data-contacts1-js').on('change', '.input-small', function(){
                      update(this);
                });
                $('#fetchContacts1').click(function() {
                      fetchData1();
                });
          });
          function update(el){
              $.ajax({
                  type:"POST",
                  url:"http://localhost/service4homes/updateBooking.php",
                  data: { status: $(el).val(), id: $(el).attr('id')},
                  success: function(response){
  
                      alert("success");
  
                  },
                  error: function(){
                      alert("fail");
                  }
              })
          };
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>HTML Code</strong></p>
  
  <pre><code>&lt;div class="row-fluid"&gt;
  
          &lt;div class="block"&gt;
              &lt;div class="navbar navbar-inner block-header"&gt;
                  &lt;div class="muted pull-left"&gt;Carpenter Services&lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="block-content collapse in"&gt;
                  &lt;div class="span12"&gt;
                       &lt;table class="data-contacts1-js table table-striped" &gt;
                            &lt;thead&gt;
                              &lt;tr&gt;
                                    &lt;th&gt;ID&lt;/th&gt;
                                    &lt;th&gt;Customer Name&lt;/th&gt;
                                    &lt;th&gt;Customer Mobile&lt;/th&gt;
                                    &lt;th&gt;Customer Email&lt;/th&gt;                                    
                                    &lt;th&gt;Status&lt;/th&gt;
                              &lt;/tr&gt;
                            &lt;/thead&gt;
                        &lt;tbody&gt;
  
                        &lt;/tbody&gt;
                      &lt;/table&gt;                                    
                  &lt;/div&gt;
                  &lt;button id="fetchContacts1" class="btn btn-default" type="submit"&gt;Refresh&lt;/button&gt;                          
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;!-- /block --&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>Server code</strong></p>
  
  <pre><code> &lt;?php
          header('Access-Control-Allow-Origin: *');//Should work in Cross Domaim ajax Calling request
          mysql_connect("localhost","root","1245");
          mysql_select_db("services");
          $response = array();
          if(isset($_POST['type']))
          {
              $status = $_POST ['status'];              
              $id=$_POST ['id'];  
              $result = mysql_query("UPDATE booking SET sps_id = '$status' WHERE b_id = $id");        
              if($result){
                  $response["success"]=1;
                  $response["message"]="Product successfully updated.";
                  echo json_encode($response);
              } else{
                  $response["success"]=0;
                  $response["message"]="Product unsuccessfully updated.";
                  echo json_encode($response);
              }
          }
          else{
              $response["success"]=0;
              $response["message"]="Required fields is missing.";     
              echo json_encode($response);
          }
      ?&gt;
  </code></pre>