Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created April 21, 2020 15:11
Show Gist options
  • Save azamsharp/225af97dc5939e8bb65d47b750092a2c to your computer and use it in GitHub Desktop.
Save azamsharp/225af97dc5939e8bb65d47b750092a2c to your computer and use it in GitHub Desktop.
// access textbox
let fullNameTextBox = document.getElementById("fullNameTextBox")
// access button
let submitButton = document.getElementById("submitButton")
//fullNameTextBox.value // ???
/*
function submitButtonPressed() {
console.log("Submit button pressed")
} */
submitButton.addEventListener("click",function() {
// get the value in the textbox
let fullName = fullNameTextBox.value
// print out the value on the console
console.log(fullName)
})
<html>
<head>
</head>
<body>
<input type="text" id="fullNameTextBox"></input>
<button id="submitButton">Submit</button>
<script src="js/app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment