Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
initial commit
  • Loading branch information
reejuBhattacharya committed Feb 16, 2022
commit 1c193bf3f0c668f07f1bc484d1bd775f722d1b93
7 changes: 7 additions & 0 deletions src/dom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ p5.prototype.createRadio = function() {
};

self.selected = function(value) {
// console.log('Hello');
let result = null;
if (value === undefined) {
for (const option of self._getOptionsArray()) {
Expand All @@ -952,6 +953,12 @@ p5.prototype.createRadio = function() {
}
}
} else {
// forEach loop to uncheck all radio buttons before
// setting any one as checked.
self
._getOptionsArray()
.forEach(option => option.removeAttribute('checked'));

for (const option of self._getOptionsArray()) {
if (option.value === value) {
option.setAttribute('checked', true);
Expand Down