There is a div with an array of checkboxes. How do I know, by clicking, which element I chose? That's the way I do
$(".cities_list").on('click', function() { var ids = $( ".select_cities :checked" ).map(function () { return this.value; }) console.log($ids) }); Thus, I get an id array, it does not work correctly, the first element is undefined, and the second is the selected id, or if it displays two id, then it is different then the same one.
All because we are looking around the div. Is there any other way to find out the id of the specifically "checked" element? Something similar mouseup - to intercept the one item that was checked, and not to go through the whole div ??