JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="button" value="Click me" />

CSS

span{position:relative;}
img{position:absolute; right:2px; top:2px;}

JavaScript

$('input[type="text"]').wrap('<span></span>').after('<img src="http://www.softenersupplies.com/images/close.png" alt="" />');

$('img').click(function(){
   $(this).parent().find('input').val('');
});