Skip to content

Commit

Permalink
Define the value of the Toggle elements as a number (#476)
Browse files Browse the repository at this point in the history
- Toggle elements already added have an initial value of undefined.
- Set to 0 when undefined.
- Set 1 to on and 0 to off when clicking on Toggle elements.

Signed-off-by: DoHyung Lim <delight.lim@samsung.com>
  • Loading branch information
DohyungLim authored Nov 14, 2019
1 parent c9d93c0 commit 4153e31
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/js/profile/mobile/widget/mobile/ToggleSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,11 @@
var self = this,
element = self.element;

return self._type === "input" ?
parseFloat(element.value) : element.selectedIndex;
if (["checkbox", "radio"].indexOf(element.type) > -1) {
return (element.checked) ? 1 : 0;
}

return element.selectedIndex;
};

/**
Expand Down

0 comments on commit 4153e31

Please sign in to comment.