Last active
November 14, 2018 12:40
-
-
Save harrisonmalone/68d22c9024c952944873778e5717d58b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<style> | |
.wrapper { | |
display: flex; | |
flex-direction: column; | |
justify-content: center; | |
align-items: center; | |
height: 100vh; | |
} | |
input { | |
border: 2px solid black; | |
padding: 20px; | |
font-size: 25px; | |
} | |
h1 { | |
font-family: sans-serif; | |
font-size: 80px; | |
text-align: center; | |
} | |
</style> | |
<script defer src="script.js"></script> | |
</head> | |
<body> | |
<div class="wrapper"> | |
<h1 id="title"></h1> | |
<input type="text" name="user-input"> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make h1 dynamically update to what you type into input | |
// get title | |
const title = document.querySelector("#title") | |
// get input | |
const userInput = document.querySelector("input[name='user-input']") | |
// create input event listener | |
userInput.addEventListener("input", function(event) { | |
title.innerHTML = event.currentTarget.value | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment