我正在尝试使用vanilla JS来按元素ID更改CSS属性?
我试图达到以下效果:
btn-dark
改为btn-warning
。btn-dark
更改为btn-warning
。我目前的尝试:
<div class="row">
<button *ngFor="let number of [1,2,3,4,5,6,7,8,9,10]"
type="button"
class="btn btn-dark"
id="d{{number}}"
>
</button>
</div>
<div class="row">
<button (click)="onClick($event)"
*ngFor="let number of [1,2,3,4,5,6,7,8,9,10]"
type="button"
class="btn btn-secondary"
id="b{{number}}">{{number}}
</button>
</div>
答案 0 :(得分:1)
答案 1 :(得分:0)