In this tutorial, I am going to cover 2 basic methods which you can use to trigger click event programmatically in javascript. To do this, you sign-up for a local meetup called "Women Who Code" and subscribe to notifications. if (some_conditions){ To enable it you have to pass the capture option in addEventListener(). https://www.quirksmode.org/js/events_order.html We do this by assigning it a class of open in the else block, which makes it show the rest of the article. If I've understood your question correctly, then you are looking for the mouseup event, rather than the click event: $("#message_link").mouseup The transition property ensures that every change happens after 1 second. Why was the nose gear of Concorde located so far aft? setTimeout may help out here $("#message_link").click(function(){ Then you store the value in a variable. Let's take a closer look at the code from the last example: The HTML