【问题标题】:How to make textAngular active by default?默认情况下如何使 textAngular 处于活动状态?
【发布时间】:2017-12-21 10:02:55
【问题描述】:

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

有没有办法让 text-angular 默认启用或始终启用?

【问题讨论】:

    标签: angularjs textangular


    【解决方案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();
    })
    

    【讨论】:

    • 我已经试过了,还是不行。 textAngular 启用 mousedown 并检查 event.isTrusted。编辑插件代码不是一个选项,项目会自动部署并从 github 下载代码。
    猜你喜欢
    • 2014-11-20
    • 2018-01-23
    • 2017-07-09
    • 1970-01-01
    • 2021-01-03
    • 2017-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多