WIM/WIM4.1/tp/tp3/ex2/js/helpers.js

20 lines
367 B
JavaScript
Raw Normal View History

2022-05-10 12:21:29 +02:00
function debounce(fn, wait)
{
let timeout;
return (...args) => {
clearTimeout(timeout);
timeout = setTimeout(() => fn(...args), wait);
}
}
function autocomplete(datalist,communes)
{
// À compléter
datalist.innerHTML = '';
for(let c of communes) {
let option = document.createElement("option");
option.value = c;
datalist.appendChild(option);
}
}