$(document).on('click', '.clear-input', function() {
$(this).closest('.search').find('.input-class').val('');
});
<style>
x-field{
display:inline;
position:relative;
}
x-field .close {
position:absolute;
padding:0 5px;
right:0;
}
</style>
<x-field>
<input type="text" id = "text">
<span class="close" onclick="this.previousElementSibling.value = ''">
×
</span>
</x-field>