The code I have to validate the button does not work:
$(document).ready(function(){
$("#sendCat").prop('disabled', true);
if ($('#cat').val()!= "") {
$("#sendCat").prop('disabled', false);
}
});
<form action="proc_cat.php" method="post">
<div class="input-field col s5">
<input id="cat" name="name_cat" type="text">
<label>Categoria:</label>
</div>
<div class="input-field col s5">
<input name="sub_cat" type="text">
<label>SubCategoria</label>
</div>
<div class="input-field col s2">
<button id="sendCat" class="btn">Adicionar</button>
</div>
</form>