You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Get the value of the name input from the form and update the greeting
const greetingText = document.querySelector("#greeting"); // get greeting element
const inputElement = document.querySelector("#exampleFormControlInput1"); // get input element
const btn = document.querySelector("#exampleFormBtn"); // get the element with id = 'exampleFormBtn'
btn.addEventListener("click", function () {
// add an event to the button: whenever the button is pressed, update the greeting name
// CHALLENGE step 3 of 3: JS. In the next line change the word Hello to another greeting word. Save the file. Type a name in the box. Click Submit.
greetingText.innerHTML = `Hello, ${inputElement.value}`; // this is a templated string in Javscript! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals