title: Passing data-id from button to bootstrap modal
body: <p>I try to pass the 'data-id' from the code below:    </p>
  
  <pre><code>&lt;a data-toggle="modal" data-id="10" class="passingID"&gt;
     &lt;button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#editkaryawan"&gt;
         &lt;i class="fas fa-pencil-alt"&gt;&lt;/i&gt; Edit&lt;/button&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>To an input form values here:</p>
  
  <pre><code>&lt;div class="modal-body"&gt;
      &lt;form method="post" action="tambahkaryawan.php"&gt;
        &lt;input type="hidden" class="form-control" name="idkl" id="idkl" value=""&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the jquery i use:</p>
  
  <pre><code>  &lt;script&gt;
      $(document).on("click", ".passingID", function () {
       var ids = $(this).data('id');
       $(".modal-body #idkl").val( ids );
      });
    &lt;/script&gt;
  </code></pre>