JSFiddle - React, Tailwind, and code Playground

HTML

<span>
    <input type="text" />
    <img src="http://www.softenersupplies.com/images/close.png" alt="" />
</span>

JavaScript

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