How to link javascript to html

The [removed] tag can be placed in the <head> section of your HTML, in the <body> section, or after the </body> close tag, depending on when you want the JavaScript to load.

<!DOCTYPE html>
<title>My Example</title>
<button onClick="[removed]exampleFunction()">Click Me</button>


In Progress 30-11-2019 Huzaifa Arshad 197

Please briefly explain why you feel this question should be reported .

Answers (1)

junaid khan 5


Please briefly explain why you feel this answer should be reported .

The src attribute specifies the URL of an external script file. If you want to run the same JavaScript on several pages in a web site, you should create an external JavaScript file, instead of writing the same script over and over again. Save the script file with a .js extension, and then refer to it using the src attribute in the [removed] tag. Note: The external script file cannot contain the [removed] tag. Note: Point to the external script file exactly where you would have written the script.

Leave An Answer