JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" value="Don't clear me"/>
<input type="text" value="enter highlight"/>
<input type="text" value="enter highlight"/>
<input type="text" value="Don't clear me"/>
<button id='each'>Do Each Call</button>
<button id='attr'>Do Attribute Call</button>
CSS
input {
display: block;
}
JavaScript
$('#each').click(function(){
$('input:text').each(function(){
if ($(this).val() == 'AAA') {
$(this).val('');
}
});
});
$('#attr').click(function(){
$('input[value="AAA"]').val('');
});