checkboxes to array

by Akram kamal

HTML

<input type="checkbox" value="1234" checked />
<input type="checkbox" value="2345664" checked />
<input type="checkbox" value="NO" />

<input type="button" id="btn" value="click"/>

JavaScript

// http://stackoverflow.com/questions/16170828/jquery-get-values-of-checked-checkboxes-into-array

$("#btn").click(function(event){
    event.preventDefault();
    var searchIDs = $("input:checkbox:checked").map(function(){
        return this.value;
    }).toArray();
    
    console.log(searchIDs);
                   
  })