我正在尝试将属性设置为 html 元素,但收到错误类型“HTMLCollectionOf”不可分配给类型“HTMLElement”
这是我的打字稿代码---
let elem: HTMLElement= document.getElementsByClassName('notification-top-bar');
setTimeout(elem.setAttribute("style", "display:none;"), this.duration);Run Code Online (Sandbox Code Playgroud)
这是我的 HTML 代码---
<div class="row">
<div *ngFor="let n of notifications" class="notification-top-bar" [ngClass]="type" style="display: block;">
{{message}}
<a class="close glyphicon glyphicon-close" (click)="onCloseNotifications($event)"></a>
<p>{{n}}</p>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
我正在使用超棒的字体图标按钮,我需要使图标处于禁用状态。我可以使用Bootstrap禁用类使它看起来像禁用按钮,但是它是可单击的。有什么办法可以使非点击?
这是我的HTML代码:-
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<button class='btn btn-primary disabled' disabled>
<i class="fa fa-search"></i>
</button>Run Code Online (Sandbox Code Playgroud)