How to get checkbox checked attribute id when button clicked in jQuery.

I have list of check boxes with attribute id and a button when I check on checkbox and click on button it will return id of selected checkbox.

how to get selected if using jquery


Here, we created one HTML file. Which is hold HTML and Jquiry code.

<!DOCTYPE html>
<script src="">

<div id="checkboxlist">
  <div><input type="checkbox" id="Java" class="chk">Java</div>
  <div><input type="checkbox" id="Php" class="chk">Php</div>
  <div><input type="checkbox" id="Html" class="chk">Html</div>
  <div><input type="checkbox" id="Python" class="chk">Python</div>
    <input type="button" value="Click" id="buttonClass">
    $("#buttonClass").on("click", function() {
  var checkedIds = $(".chk:checked").map(function() {
  alert(checkedIds.join(", "));