let txtMainSearch = document.querySelector('#txt-main-search'); window.onload = function(){ autocomplete(txtMainSearch, results); };