Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

$input now fires change event #1

Merged
merged 1 commit into from

2 participants

@jhogendorn

this also clears some jslint warnings, but its mostly so you can detect that the input was changed.

@minhur minhur merged commit c41b5bc into minhur:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 12, 2013
  1. @jhogendorn
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 11 deletions.
  1. +5 −4 js/bootstrap-toggle.js
  2. +6 −7 js/bootstrap-toggle.min.js
View
9 js/bootstrap-toggle.js
@@ -5,17 +5,18 @@
* This content is released under the MIT License.
*/
!function ($) {
- $(document).on('click.bootstrap-toggle', '[data-toggle^=toggle]', function(e) {
+ $(document).on('click.bootstrap-toggle', '[data-toggle^=toggle]', function() {
var $toggle = $(this);
var $input = $(this).find('input[type=checkbox]');
if ($toggle.hasClass('off')) {
- $toggle.attr('class', 'toggle ' + $toggle.find('.toggle-on').attr('class').replace(/toggle-on/g,''))
+ $toggle.attr('class', 'toggle ' + $toggle.find('.toggle-on').attr('class').replace(/toggle-on/g,''));
$input.prop('checked', true);
$toggle.removeClass('off');
} else {
- $toggle.attr('class', 'toggle ' + $toggle.find('.toggle-off').attr('class').replace(/toggle-off/g,''))
+ $toggle.attr('class', 'toggle ' + $toggle.find('.toggle-off').attr('class').replace(/toggle-off/g,''));
$input.prop('checked', false);
$toggle.addClass('off');
}
+ $input.change();
});
-}(window.jQuery);
+}(window.jQuery);
View
13 js/bootstrap-toggle.min.js
@@ -1,7 +1,6 @@
-/*
-* bootstrap-toggle v1.0
-* -----------------------------------
-* Copyright 2013 Min Hur, The New York Times Company
-* This content is released under the MIT License.
-*/
-!function(a){a(document).on("click.bootstrap-toggle","[data-toggle^=toggle]",function(c){var b=a(this);var d=a(this).find("input[type=checkbox]");if(b.hasClass("off")){b.attr("class","toggle "+b.find(".toggle-on").attr("class").replace(/toggle-on/g,""));d.prop("checked",true);b.removeClass("off")}else{b.attr("class","toggle "+b.find(".toggle-off").attr("class").replace(/toggle-off/g,""));d.prop("checked",false);b.addClass("off")}})}(window.jQuery);
+/*
+* bootstrap-toggle v1.0
+* -----------------------------------
+* Copyright 2013 Min Hur, The New York Times Company
+* This content is released under the MIT License.
+*/!function(e){e(document).on("click.bootstrap-toggle","[data-toggle^=toggle]",function(){var t=e(this),n=e(this).find("input[type=checkbox]");if(t.hasClass("off")){t.attr("class","toggle "+t.find(".toggle-on").attr("class").replace(/toggle-on/g,""));n.prop("checked",!0);t.removeClass("off")}else{t.attr("class","toggle "+t.find(".toggle-off").attr("class").replace(/toggle-off/g,""));n.prop("checked",!1);t.addClass("off")}n.change()})}(window.jQuery);
Something went wrong with that request. Please try again.