My issue
whats wrong in this code?
My code
// select the input text field using getElementById
const textInput = document.getElementById("textInput");
// select the submit button using getElementById
const submitButton = document.getElementById("submitButton");
// select the output div using getElementById
const outputDiv = document.getElementById("outputDiv");
// Add the event handler to the submitButton to get the data from the input field and add it to a textDiv which in turn is added to the output div.
submitButton.addEventListener('click' , () => {
const inputText = textInput.value;
outputDiv.textContent = inputText;
});
Learning course: Web development using JavaScript
Problem Link: Challenge #1 - Adding text from input field to DOM Practice Problem in Web development using JavaScript - CodeChef