-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02-week-html-tied-js.html
More file actions
44 lines (35 loc) · 1.1 KB
/
02-week-html-tied-js.html
File metadata and controls
44 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>My greeter page</h1>
<ol>
Create an HTML page
Create the boilerplate DOCTYPE
Add a form
Add a button
Add a place for the output to display
Create a JavaScript file
Create a function called greeter
Linking the JS to HTML
Getting the HTML property (getElementBy....Id, Class, TagName, etc)
DOM events - onclick, onmouseup, onmousedown, many more
Add the script tag to HTML body to import the JS file
</ol>
<p>
</p>
<input type="text" id="user-input">
<button type="button" name="button" onclick="greeter()">Click me!</button>
<h3 id="output"></h3>
<script type="text/javascript" src="greeter.js"></script>
</body>
</html>
document.getElementById("idHere").value
document.getElementById("idHere").innerHTML
const greeter = () => {
let userName = document.getElementById("user-input").value
document.getElementById("output").innerHTML = `Welcome, ${userName}!`
}