i have this code:
html:
<input name="q" id="searchbox-input" type="text" value="" autocomplete="off">
javascript:
$(function(){
$('#searchbox-input').on('input',function(e){
e.preventDefault();
let input = $(this).val();
searchbox(input);
});
});
function searchbox( input ){
console.log( input );
}
onInput() the value of #searchbox-input gets written to the console. this works as it should.
on my android phone the keyboard has word suggestions:
if you type in A e.g. Android will be suggested.
the problem: if i click on one of these suggestions, the function is triggered twice. the same input (e.g. Android) is written twice to the console