Download file using jQuery / JavaScript

In this article, we will share a simple script about how to download file using jQuery or JavaScript. Example will focus on jQuery click event.

Suppose we have a button or a link which has id=”download_file”.


We want to download the file when a user clicks on this button.


This is a very simple script about how to download file using jQuery / JavaScript.



Read More

jQuery click not working on dynamic content [solution]

jQuery click not working? Follow this article to find a solution.

Sometimes you may come across an issue where jquery event does not work on an element, which is generated dynamically via jQuery. For example, if you have any HTML element on which you click to create/append some other HTML element, jQuery click will not work on the appended or dynamically created element on the page.

If the code is not working on dynamically created content, the code might be as follows.

.class_name is actually the name of class of the element that was generated by jQuery, dynamically.

In such case, you will have to modify your code a bit in the following way.

This change in code has always worked for me whenever I wanted to trigger a function on the event or simply click event upon dynamically created content. I hope this will work you, too.

For further study:

Jquery event handler not working on dynamic content

Read More