Points to remember!
- You can place these <script> tags either in the <head> section or in the <body> section.
Condition 1: Adding JS file using the file path
In the above example, we are creating an input field that asks the user to input his/her name.
alert("Your name has been submitted!");
Once the user presses the submit button, an alert message is displayed.
Use the following syntax, to add your file path to the src attribute in the <script> tag.
Condition 2: Adding JS file using URL
In the above file we have defined our function that is intended to display an alert message when the user presses the submit button.