![]() |
Definition and UsageThe When present, it specifies that the script is executed when the page has finished parsing. Note: The Note: There are several ways an external script can be executed:
Applies toThe
Browser SupportThe numbers in the table specify the first browser version that fully supports the attribute. |
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The script defer attribute</h1>
<script src="demo_defer.js" defer></script>
<p>The script above requests information from the paragraph below. Normally, this is not possible, because the script is executed before the paragraph exists.</p>
<p id="p1">Hello World!</p>
<p>However, the defer attribute specifies that the script should be executed later. This way the script can request information from the paragraph.</p>
</body>
</html>
html defer attribute |
How to add A script that will not run until after the page has loaded | HTML Attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |
Views: | 65 |
Reffered: https://www.w3schools.com/tags/att_defer.asp