如何使textAngular默认处于活动状态?

时间:2017-12-21 10:02:55

标签: angularjs textangular

我使用textAngular,它在页面加载时处于非活动状态,仅在用户点击输入时才变为活动状态。这意味着它的所有按钮,例如"插入视频"将被禁用,直到文本输入不会被聚焦。

有没有办法在默认情况下启用text-angular或使其始终启用?

1 个答案:

答案 0 :(得分:1)

document.getElementById("<id of the element you want to focus on>").focus();

如果这不起作用,请尝试应用超时:

setTimeout(function() { document.getElementById("<id of the element you want to focus on>").focus(); }, 2000);

此外,如果您像我们大多数人一样使用jQuery,请尝试将.focus()与我们的经典行结合使用:

$(document).ready(function(){
document.getElementById("<id of the element you want to focus on>").focus();
})