JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="my-input">
<div id="follow-attr">Follow attribute again...</div>
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', () => {
/* Remove the property value to let input follow the attribute again */
})
/* START Uncontrollable external part */
let ctr = 0;
setInterval(() => {
ctr++;
$('#my-input').attr('value', ctr);
}, 1000);
/* END Uncontrollable external part */