1
I want to do something like in Excel. I have two inputs and in each I type values. By pressing ENTER I want to capture the entered values, how can I do this? OBS: I’m using Angular 1.
<div class="descontoPromo">
<input class="form-control depro" type="text" name="descontoPromocional" ng-model="valor.descPromo" >
</div>
<div class="descontoFin">
<input class="form-control defin" type="text" name="descontoFinanceiro" ng-model="valor.descFinan" >
</div>
You could use ngModel for that, as I understand it, you should just use the values of
valor.descPromo
andvalor.descFinan
– Rodrigo K.B
This is if I use a function flame on a button in a form, but I don’t want to use a form or button.
– GustavoSevero
You don’t want a button, because you want the function to be called by enter, or you have another reason? Because if it is by enter, da para colocar um botão oculto, e que tratar no Js para fazer o enter execute o clique do botão.
– Rodrigo K.B
Exactly, "do not want button, because you want the function to be called by enter". And how to do this treatment in JS to run the button?
– GustavoSevero
published the answer with an example of how to do it. I remembered that I use it without having this invisible button. I hope it helped you.
– Rodrigo K.B