Call a JavaScript Function Into an HTML Body

This article explains how to call a JavaScript function to execute in an HTML body by using the <script> tag. It also shows how to create the function in a JavaScript file and link it to the HTML file.

Call a JavaScript Function in a HTML <script> Tag

If you are using a JavaScript function, one of the best places to call it in an HTML body is in a

<script> thisFunction();</script>

For instance, a JavaScript function runtable(); created to fill an HTML table would be called as below.


​    <th>Student</th>

​    <th>Grade</th>    



DelftStack is a collective effort contributed by software geeks like you. If you like the article and would like to contribute to DelftStack by writing paid articles, you can check the write for us page.

Related Article - JavaScript Function

  • Nested Functions in JavaScript