JSFiddle - React, Tailwind, and code Playground
HTML
<form id="my-form">
<input type="text" id="my-input">
<button id="follow-attr">Follow attribute again...</button>
</form>
CSS
#follow-attr {
cursor: pointer;
border: 1px solid black;
padding: 3px;
}
JavaScript
/*
1. Run snippet
2. Change value of input
3. Click the div - TODO: Find way to remove the property value of input
*/
$('#follow-attr').on('click', (e) => {
document.getElementById('my-form').reset();
e.preventDefault();
})
/* START Uncontrollable external part */
let ctr = 0;
setInterval(() => {
ctr++;
$('#my-input').attr('value', ctr);
}, 1000);
/* END Uncontrollable external part */