JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<label for="name">Name:</label>
<input type="text" id="name">
</div>
<button id="submit">Get ID</button>
CSS
label {
font: 15px 'Exo 2', sans-serif;
}
input {
margin: 6px;
}
button {
margin-top: 10px;
padding: 3px;
font: 15px 'Exo 2', sans-serif;
}
JavaScript
document.getElementById('submit').onclick = function() {
alert(document.getElementsByTagName('input')[0].id);
}