Skip to content
This repository has been archived by the owner on May 28, 2020. It is now read-only.

Trigger "change" event #4

Open
AlexeyKosov opened this issue Feb 25, 2016 · 3 comments
Open

Trigger "change" event #4

AlexeyKosov opened this issue Feb 25, 2016 · 3 comments

Comments

@AlexeyKosov
Copy link

Currently it doesn't trigger "change" event for children checkboxes so there's no way to perform an action after all the checkboxes are checked/unchecked.

@durdenk
Copy link

durdenk commented Aug 18, 2016

+1 for this.
I need to count all checkboxes and selected checkboxes and report to user,
Upon clicking checkbox, it does that but in wrond order.

@adaniello
Copy link

Simply update line 23 in

$children.prop('checked', $(this).prop('checked')).change();

(fire change on childrens)

@bs-thomas
Copy link

FYI this is what I've done 2 years ago.

  checkAll.prototype.init = function() {
    this._checkChildren();

    var plugin = this;

    this.$el.on('change', function(e) {
      var $children = $(plugin.options.childCheckboxes, plugin.options.container).not(plugin.$el);
      
      // 2015/9/5 modified by Thomas @ BeamStyle: Modification to only change checkboxes that need change, and then triggering the change event for those checkboxes
      var isChecked = $(this).prop('checked');
      $children = isChecked ? $children.not(':checked') : $children.filter(':checked');
      $children.prop('checked', $(this).prop('checked')).trigger("change");
    });

    $(this.options.container).on('change', plugin.options.childCheckboxes, function(e) {
      plugin._checkChildren();
    });
  };

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants