Sha256: 09f82b218d86c9d98bdfe5aa372fd1bfd8a682ad80e90e8ce8e983a29148e444
Contents?: true
Size: 658 Bytes
Versions: 12
Compression:
Stored size: 658 Bytes
Contents
window.RadioToggle = (function() { var defaults = { $target: $(".us-toggle") }; function RadioToggle(options) { this.options = Utils.setOptions(options, defaults); if (this.options.$target) { this.addEventListeners(); } else { throw new Error("No target defined"); } } RadioToggle.prototype.addEventListeners = function() { return this.options.$target.on("change", "input:radio", function(e) { $("input[name='" + this.name + "']").removeClass("checked"); if (this.checked) { $(this).addClass("checked"); } return e.stopPropagation(); }); }; return RadioToggle; })();
Version data entries
12 entries across 12 versions & 1 rubygems