javascriptjqueryhtmlbootstrap-4internet-explorer-11

Problem with double click on checkbox with Internet Explorer


I would like to disable the double click on checkboxes on internet explorer. The double click causes errors on the function (only on internet explorer 11).

 $('#editArchivesTable tbody').on('click', "input[type=checkbox]", function () { alreadySelected = $('#editArchivesTable tbody').find('input[type="checkbox"]:checked').parent('td').parent('tr').attr('choix(dataTable.row($(this).parent('td').parent('tr')).index(), $(this).is(':checked'))
});




$("#editArchivesTable tbody").bind('dblclick', "input[type=checkbox]", (function (event) {
    event.preventDefault();
}));

I'm waiting for my function choix not to be triggered when double clicking

For example, when double clicking on a checkbox, the value "85" is inserted twice in my list


Solution

  • Instead of the click event, use the change event.

    In the change event check the state of the checkbox.

    If it is checked, add the value to the array. If not, remove it from the array.