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.
Example!

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

Votes

In Progress 30-11-2019 Huzaifa Arshad 146

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

Answers (1)

junaid khan 5

06-12-2019

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