document.addEventListener("DOMContentLoaded", function() { search(); }); function search() { console.log('search') }