【问题标题】:How to code input validation on focusout in Meteor JS?如何在 Meteor JS 中对焦点输出进行输入验证?
【发布时间】:2019-10-17 23:29:25
【问题描述】:

在进入 Meteor JS 中的下一个输入字段之前,如何在 focusout 上验证输入字段?就像在 AngularJS 中一样。

【问题讨论】:

  • 如果您使用自动表单,您可以选择这样做。

标签: validation meteor input meteor-blaze


【解决方案1】:

将事件处理程序附加到字段的change 事件,例如:

Template.myTemplate.events({
  'change #myField'(event) {
    // do your validation here
  }
});

【讨论】:

    【解决方案2】:

    您可以在此类事件中使用focusout

    Template.templateName.events({
      'focusout #inputId' (event, instance) {
        // insert code in here :D 
      }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 1970-01-01
      • 2021-09-11
      • 1970-01-01
      • 2019-12-09
      • 2012-01-20
      • 1970-01-01
      相关资源
      最近更新 更多