JSFiddle - React, Tailwind, and code Playground

by AlexP11223

HTML

<input id="myInput" type="text" value="hello">
<button id="myButton">Press me</button>

JavaScript

const button = document.querySelector('#myButton')
const input = document.querySelector('#myInput')

button.addEventListener('click', () => {
  const text = input.value
  alert(text)
})