title: Get the id of closest select element on button click..jquery
body: <pre><code>  &lt;td class="col-sm-2"&gt;
            &lt;select class="form-control newclass addvalue input_color"  id="sugar_id"&gt;
              &lt;option value=""&gt;Select Value&lt;/option&gt;
              &lt;option value="ABSENT"&gt;ABSENT&lt;/option&gt;
              &lt;option value="PRESENT"&gt;PRESENT&lt;/option&gt;
            &lt;/select&gt;
         &lt;div id="sssugar_id"&gt;
           &lt;input id="myInput1" class="form-control" required="" placeholder="Fill  Value Or Select Dropdown" style="margin-top: 5px;border-color: green;border-width: medium;" type="text"&gt;
          &lt;button type="button" id="mybtn1" class="btn btn-success button_class" style="margin-top: 5px;" onclick="addtest(1)"&gt;ADD&lt;/button&gt;
         &lt;/div&gt;
    &lt;/td&gt;
  </code></pre>
  
  <p>I am appending input and button dynamically, how can I get the id of the closest select element on a button click?</p>