$(document).ready(function(){ $('.navbar-nav a').on('click', function(){ $('.navbar-collapse').collapse('hide'); }); }); document .querySelector(".custom-file-input") .addEventListener("change", function (e) { var fileName = document.getElementById("fw-update-file").files[0].name; var nextSibling = e.target.nextElementSibling; nextSibling.innerText = fileName; });