diff --git a/bootstrap-switch.js b/bootstrap-switch.js index dd1c64e..321d82e 100644 --- a/bootstrap-switch.js +++ b/bootstrap-switch.js @@ -45,7 +45,12 @@ return this.each(function(e) { var c = $(this); - var disabled = c.is(":disabled") ? " disabled" : ""; + var disabled = c.is(':disabled') ? ' disabled' : ''; + + // Remove the ability to tab to the secondary (white) toggle button. + var tabindex = ' tabindex="-1"', + // Hide second button from screen readers. + aria = ' aria-hidden="true"'; var div = $('
').insertAfter(this); var on = $('').html(settings.on).css('margin-right', '0px').appendTo(div); @@ -63,8 +68,8 @@ } applyChange(c.is(':checked')); - on.click(function(e) {e.preventDefault();c.prop("checked", !c.prop("checked")).trigger('change')}); - off.click(function(e) {e.preventDefault();c.prop("checked", !c.prop("checked")).trigger('change')}); + on.click(function(e) {e.preventDefault();c.prop('checked', !c.prop('checked')).trigger('change')}); + off.click(function(e) {e.preventDefault();c.prop('checked', !c.prop('checked')).trigger('change')}); $(this).hide().on('change', function() { applyChange(c.is(':checked'))