1 回答

TA貢獻1909條經驗 獲得超7個贊
請檢查HTML5 標準中的按鈕定義
內容模型:表述內容,但不得有交互式內容后代。
根據您的代碼,您想要單擊按鈕元素內的子元素,這在 IE 瀏覽器中不起作用。
我建議您修改代碼如下(將單擊事件添加到按鈕元素,而不是 div 標簽):
<div class="horizontal-align" *ngFor="let taxId of selectedTaxIds">
? ? <button class="btn btn-rounded" disabled *ngIf="taxId.Tin !== 'All'" (click)="newfun()">
? ? ? ? ?<span >Taxi ID: </span>
? ? ? ? ?<span class="text-semibold pl-4"> {{ taxId.Tin }} </span>
? ? ? ? ?<div class="close-btn" >
? ? ? ? ? ? ? <mat-icon class="icon-display"? svgIcon="close"></mat-icon>
? ? ? ? ?</div>
? ? ?</button>
</div>
此外,您還可以將按鈕元素更改為 div 標簽,如下所示:
<div class="horizontal-align" *ngFor="let taxId of selectedTaxIds">
? ? <div class="btn btn-rounded" disabled *ngIf="taxId.Tin !== 'All'">
? ? ? ? ?<span >Taxi ID: </span>
? ? ? ? ?<span class="text-semibold pl-4"> {{ taxId.Tin }} </span>
? ? ? ? ?<div class="close-btn" (click)="newfun()" >
? ? ? ? ? ? ? <mat-icon class="icon-display"? svgIcon="close"></mat-icon>
? ? ? ? ?</div>
? ? ?</div>
</div>
- 1 回答
- 0 關注
- 113 瀏覽
添加回答
舉報