参见英文答案 >
Select the text inside an input using Typescript in Angular 2 1个
如何在TypeScript中的输入字段中选择文本.
如何在TypeScript中的输入字段中选择文本.
在Javascript中这个wpuld看起来像这样:
document.getElementById('id').select();
但TypeScript不支持select(错误:[ts]属性’select’在类型’HTMLElement’上不存在.)
添加了一些想法:
它可能是一个问题beacouse我使用dx控件,他们创建一个包装器.你可以在这里看到html:
<dx-text-Box _ngcontent-c1="" id="test" ng-reflect-@R_502_6422@abled="false" ng-reflect-value="0:00" class="dx-texteditor dx-widget dx-textBox"> <div class="dx-texteditor-container"> <input autocomplete="off" class="dx-texteditor-input" type="text" spellcheck="false" tabindex="0" role="textBox"> <div data-dx_placeholder="" class="dx-placeholder dx-state-invisible"></div><div class="dx-texteditor-buttons-container"> </div></div></dx-text-Box>
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。