Skip to content

Commit

Permalink
Resolves #127 - data-toggle=enable was broken for select boxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tbar0970 committed Feb 14, 2016
1 parent fca06a4 commit e49baee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion resources/js/tb_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ $(document).ready(function() {
// Ability to enable/disable the children of a related element
// using data-toggle="enable" and data-target="selector of what to enable/disable"
$('[data-toggle=enable], [data-toggle=disable]').change(function() {
var newDisabledVal = $(this).attr('data-toggle') == 'disable' ? this.checked : !this.checked;
var newDisabledVal = ($(this).attr('data-toggle') == 'disable') ? this.checked : !this.checked;
if (this.type == 'radio') {
$('input[name='+this.name+']').each(function() {
if ($(this).attr('data-target')) {
Expand All @@ -126,6 +126,7 @@ $(document).ready(function() {
} else if (this.type == 'checkbox') {
$($(this).attr('data-target')).attr('disabled', newDisabledVal);
} else {
var newDisabledVal = ($(this).attr('data-toggle') == 'disable') ? this.value : !this.value;
// eg select box
$($(this).attr('data-target')).attr('disabled', newDisabledVal);
}
Expand Down

0 comments on commit e49baee

Please sign in to comment.