JSFiddle - React, Tailwind, and code Playground
by techiedelight
HTML
<div id="container">
<label for="name">Enter a value:</label>
<input type="text" id="name">
</div>
<button id="submit">Set Value</button>
CSS
label {
font: 15px 'Exo 2', sans-serif;
}
input {
margin: 6px;
}
button {
margin-top: 10px;
padding: 2px 5px;
font: 15px 'Exo 2', sans-serif;
}
JavaScript
document.getElementById("submit").onclick = function() {
document.getElementById("name").setAttribute('value', 'Default value');
}