Skip to content

Commit

Permalink
Merge pull request #230 from smariussorin/patch-2
Browse files Browse the repository at this point in the history
preserve selected value on radiolist change
  • Loading branch information
stefanprodan committed Apr 2, 2015
2 parents 3dfed4f + 08aaa60 commit ed31cdc
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@

var RadioButtonsListUpdateSelf = (function () {
function RadioButtonsListUpdateSelf(self, value, fromReset) {
var options = self.data('options') || {};

self.find("input[type='radio']").each(function () {

var $current = $(this),
wasChecked = $current.prop("checked"),
newVal = $current.val() == value ? true : false;

if (newVal && wasChecked && fromReset !== true) {
if (newVal && wasChecked && options.preventDeselect !== true && fromReset !== true) {
newVal = false;
}

Expand All @@ -156,4 +158,4 @@
}
return RadioButtonsListUpdateSelf;
})();
})
})

0 comments on commit ed31cdc

Please sign in to comment.