JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input type="text" name="searchArticle" id="clearTxt" />
<input type="button" value="Search" id="button" />
</form>
JavaScript
$(function() {
$("#button").click(function() {
alert('button clicked'); // this is calling
setTimeout(function() {
alert('setTimeout'); // this is not calling
document.getElementById('clearTxt').value = "";
}, 5000);
});
});