-2
I have two buttons that their ID comes from a database die:
<tr *ngFor="let dads of DadosOs">
<td><button type="button" class="btn btn-success but" id="{{dads.NUMOS}} - A" value = "{{dads.CODPROD}} - {{dads.ITEM}}"
#ref (click)="BaixaOkey(ref.id, ref.value)">SIM</button></td>
<!-- ! -->
<td><button type="button" class="btn btn-danger but" id="{{dads.CODPROD}} - {{dads.ITEM}} " value="{{dads.NUMOS}}"
#ref2 (click)="not(ref2.id, ref2.value)" data-toggle="modal" data-target="#modalNao">NÃO</button></td>
<!-- ! -->
<td>{{dads.ITEM}}</td>
<td>{{dads.CODPROD}} - {{dads.PRODUTO}}</td>
</tr>
And on TS I try to disable like this:
(<HTMLInputElement>document.getElementById(id)).disabled = true;
But then just disable the 'YES' button but I need to disable the 'NO' button too.
Have any way to disable both buttons at the same time other than by ID?
An id is like CPF, each has its own.
– Sam
I know that, but there’s no other way to disable both buttons than by id?
– Maria
I think you can for the class. See if this works:
(<HTMLInputElement>document.getElementsByClassName('but')[0]).disabled = true;
– Sam
It doesn’t work for me because then he’s tied to the [0], and I can get about 10 buttons, there can only disable that yes and no td that was clicked
– Maria