0
I’m making a table that is fed dynamically with database values. In this created table I put a field to insert the "quantity" and a button disabled by a class. I want to enable the button as soon as the user enter a value in the input "quantity", but the way I tried to do with jquery did not work, only works in the elements of the first line (product), in the remaining does not disable the button.
<tbody>
@foreach ($produtos as $produto)
<tr>
<td>{{ $produto->codigo }}</td>
<td>{{ $produto->produto }}</td>
<td>{{ $produto->unidade_medida_peso }}</td>
<td>
<input type="text" id="inputQuantidade">
</td>
<td>
<a href="#" class="btn disabled" name="addproduto" id="addproduto">
</a>
</td>
</tr>
@endforeach
</tbody>
And what I tried to do in jquery:
$( "#inputQuantidade" ).keyup(function() {
$(this).closest('tr').find('#addproduto').removeClass("disabled");
});
Perfect! Now it worked. Thank you very much, man!
– Felipe D