I have a register table in a modal, it has the save and cancel button, only when filling all the input and select obligatory it releases the save, and saves in the database, everything is working, but if I go in the change it brings all the options selected as it was saved, just do not come the save button released only releases if you pass the focus on all required fields. I would like it to release automatically since all required fields are saved.
this is javascript
jQuery(function() {
var $inputs = $(".inpSenha"), $button = $(".btnSalvar1");
var limpos = 0;
// verificação inicial
$inputs.each(function() {
var $this = $(this);
var val = $this.val();
val || limpos++;
$this.data("val-antigo", val);
});
$button.prop("disabled", !!limpos);
$inputs.on("change keyup mouseup", function() {
var $this = $(this);
var val = $this.val();
limpos += (val ? 0 : 1)
- ($this.data("val-antigo") ? 0 : 1);
$this.data("val-antigo", val);
$button.prop("disabled", !!limpos);
});
});
this is the Html of the save button
<button type="button" class="btn btn-default btnSalvar1" data-dismiss="modal" ng-click="salvarPessoas()">Salvar</button>
and the inPENSE and the class that goes in the input or select that will be mandatory who can help me