[英]how to detect html element in typescript
How can I detect an element from the HTML when there is no such element, here is a range picker I want to detect the custom range item in typescript当没有这样的元素时,如何从 HTML 中检测元素,这是一个范围选择器,我想检测 typescript 中的自定义范围项
this is the HTML code这是 HTML 代码
<form action="" id="dates">
<input [class.show-calend]="showCalendar" readonly="readonly" id="range-picker" type="text" class="form-control inspection_date"
name="dateRange" placeholder="Add date"
[formControl]="dateRange" style="cursor: pointer"
daterangepicker (selectionDone)="onSelectionDone($event)" [options]="rangeOptions" (cancelDaterangepicker)="cancel($event)" (selected)="selectedDate($event)" (ngModelChange)="ngModelChange($event)" />
</form>
this is the HTML code which is visible only when I open the dev panel on a browser这是 HTML 代码,仅当我在浏览器上打开开发面板时才可见
I solved the problem in this way我以这种方式解决了问题
elementLi:any
this.elementLi = document.getElementsByTagName('li')[7];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.