You should put the references to the jquery scripts first. <script src="jquery-3.5.1.js"></script> <script type="text/javascript" src="script.js"></script>