JSFiddle - React, Tailwind, and code Playground

by leonardeveloper

HTML

<form id="materialForm" action="#" method="post">
    <input id="materials" type="text" name="materials" value="1,2,3" readonly="readonly" disabled="disabled" />
    
</form>
<div id="display">
<button class="removes" value="1">x</button>
<button class="removes" value="2">x</button>
<button class="removes" value="3">x</button>
</div>

JavaScript

$(document).on('click','.removes',function(){
        var id = $(this).val();
    alert(id);
    $('#materials').remove(":contains('"+id+"')");
    $('#display').remove(":contains('"+id+"')");
 				return false;
 			});