Two on-change in a select

Asked

Viewed 218 times

0

Good morning, I have the following html code:

      <select class="form-control" formControlName="tipoped" on-change="PesquisaPrazo('prazo', this.digitacaoForm)" on-change="PegarCfop(this.digitacaoForm)" id="q3Id">
        <option selected>Selecione...</option>
        <option *ngFor="let tipo of tipoped" value="{{tipo.Codigo}}">{{tipo.Codigo}} - {{tipo.Nome}}</option>
      </select>

But only the first on-change function is called (Research), the second is not triggered. Is there any way to use two on-change in the same select or some way to call two functions in select?

  • The answer I gave worked friend ? Or is there something else that is not working ?

  • It is, and thank you

1 answer

2


You can call two functions like that:

<select class="form-control" formControlName="tipoped" on-change="PesquisaPrazo('prazo', this.digitacaoForm); PegarCfop(this.digitacaoForm);" id="q3Id">
   <option selected>Selecione...</option>
   <option *ngFor="let tipo of tipoped" value="{{tipo.Codigo}}">{{tipo.Codigo}} - {{tipo.Nome}}</option>
</select>

But I think the best way would be to just call a function and in it call the ones you need, for example:

function OnChange() {
    PesquisaPrazo();
    PegarCfop();
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.