Javascript 如果选中了一定数量的复选框,则禁用按钮

Javascript 如果选中了一定数量的复选框,则禁用按钮,javascript,ember.js,Javascript,Ember.js,我有一个模板,每个模板都有一些复选框: <input class="general" type="checkbox"/> <input class="about" type="checkbox"/> <input class="money" type="checkbox"/> 在按钮中: <button class="{{if allowFilter "" "disable"}}" {{action "filter"}}>Filter</b

我有一个模板,每个模板都有一些复选框:

<input class="general" type="checkbox"/>
<input class="about" type="checkbox"/>
<input class="money" type="checkbox"/>
在按钮中:

<button class="{{if allowFilter "" "disable"}}" {{action "filter"}}>Filter</button>
过滤器

但是。。好没有工作。

您可以使用
{{input checked=isChecked}
帮助程序,然后在组件中执行此操作以检查是否已选中

  actions: {
    checkedButton: function() {
      // Do whatever you want with the data (ie, save it)
      var isChecked = this.get('isChecked');
      alert('true or false? ' + isChecked);//if is checked will get true otherwise false
    }
关于这一点,有很多例子:,请查看

<button class="{{if allowFilter "" "disable"}}" {{action "filter"}}>Filter</button>
  actions: {
    checkedButton: function() {
      // Do whatever you want with the data (ie, save it)
      var isChecked = this.get('isChecked');
      alert('true or false? ' + isChecked);//if is checked will get true otherwise false
    }