Why is this jQuery click function not working?
You are supposed to add the javascript code in a $(document).ready(function() {}); block. i.e. As jQuery documentation states: “A page can’t be manipulated safely until the document is “ready.” jQuery detects this state of readiness for you. Code included inside $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute”