Javatpoint Logo
Javatpoint Logo

How to call a JavaScript Function in Html

If we want to call the JavaScript function in the Html then we have to follow the steps which are given below. Using these steps, we can easily access the JavaScript function.

Step 1: Firstly, we have to type the script tag between the starting and closing of <head> tag just after the title tag. And then, type the JavaScript function.

Step 2: After then, we have to call the javaScript function in the Html code for displaying the information or data on the web page. So, we can call the function of JavaScript by its name in the input tag of the form tag.

Step 3: And, at last, we have to save the Html file and then run the file which calls the JavaScript function.

Test it Now

The output of above Html code is shown in the following screenshot:

How to call a JavaScript Function in Html




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA