How can I connect a button to an input field? My goal is to make it so that when the button is clicked, the content of the text field is added to an array (displayed below)
const userTags = [];
function addTags(event) {
userTags.push(event.target.__ what should I use here to retrieve the input data? __)
}
<label>
Tags: <input type="text" name="todoTags"/> <button>Create new tag</button>
</label>
Once more, I am attempting to establish a connection between the button and the input field so that clicking the button will capture the input field data and append it to the 'userTag' array using the addTags() function.