[英]Angular Material Input Select All on Click?
Pretty straight-forward question.很直接的问题。 When I click on an input field I want to select-all the text so when I start typing it over-writes what was previously there.当我点击一个输入字段时,我想选择所有文本,所以当我开始输入时,它会覆盖以前的内容。 Anyone know how to do this?有谁知道如何做到这一点?
对我来说最有效的是onfocus="this.select()"
<input matInput onfocus="this.select()">
If you are using angular material 1.x, you can use md-select-on-focus
如果您使用的是 angular material 1.x,则可以使用md-select-on-focus
<md-input-container>
<label>Auto Select</label>
<input type="text" md-select-on-focus>
</md-input-container>
This link can help you md-select-on-focus此链接可以帮助您md-select-on-focus
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.