Przeglądaj źródła

Update static/js/jquery.switch.js

- Changed the use of .attr() for .prop() which is the correct way of setting element properties. This change makes the plug-in compatible with jQuery 1.9.0.
t3chn0r 12 lat temu
rodzic
commit
c0de3bcccd
1 zmienionych plików z 6 dodań i 6 usunięć
  1. 6 6
      static/js/jquery.switch.js

+ 6 - 6
static/js/jquery.switch.js

@@ -127,8 +127,8 @@
                   $this.unbind('mouseleave');
 
                   if (moving)
-                    $myCheckBox.attr('checked', !(parseInt($this.parent().css('left')) < -25));
-                  else $myCheckBox.attr("checked", !$myCheckBox.is(":checked"));
+                    $myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
+                  else $myCheckBox.prop("checked", !$myCheckBox.is(":checked"));
 
                   moving = false;
                   $myCheckBox.trigger('change');
@@ -144,7 +144,7 @@
                   $this.unbind('mouseleave');
                   $this.trigger('mouseup');
 
-                  $myCheckBox.attr('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
+                  $myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
                 });
 
                 $this.on('mouseup', function (e) {
@@ -163,10 +163,10 @@
       },
       toggleState:function (skipOnChange) {
         var $input = $(this).find('input:checkbox');
-        $input.attr('checked', !$input.is(':checked')).trigger('change', skipOnChange);
+        $input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
       },
       setState:function (value, skipOnChange) {
-        $(this).find('input:checkbox').attr('checked', value).trigger('change', skipOnChange);
+        $(this).find('input:checkbox').prop('checked', value).trigger('change', skipOnChange);
       },
       status:function () {
         return $(this).find('input:checkbox').is(':checked');
@@ -197,4 +197,4 @@
 
 $(function () {
   $('.switch').switch();
-});
+});