<p ng-repeat="x in inputContent track by $index">
<p ng-if="x.hint" ng-click="toEdit({{$index}})" class="lc-hint">{{x.placeholder}}</p>
<textarea ng-if="!x.readable" ng-model="x.value"></textarea>
</p>
由ng-repeat生成了多个这样的结构,textarea一开始隐藏,点击lc-hint,使textarea出现,如何自动获取焦点。
官方文档里的setfocus指令好像不行。求助
There is something wrong with your code:
should be written as
Why not use the native one and add the id of textarea to abc;
If you input in the console, it is best to add a delay. The focus of textarea can only be triggered when the current page is in focus state. After typing, click anywhere on the page immediately to trigger:
The setfocus you encounter does not take effect, it may be because the current page is not in focus.
Put it in your code environment, add textarea with id, the prefix I wrote is suibianla_{whatever}: