File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1580,6 +1580,9 @@ p5.prototype.createSelect = function(...args) {
1580
1580
* @method createRadio
1581
1581
* @return {p5.Element } new <a href="#/p5.Element">p5.Element</a> object.
1582
1582
*/
1583
+
1584
+ //counter for unique names on radio button
1585
+ let counter = 0 ;
1583
1586
p5 . prototype . createRadio = function ( ...args ) {
1584
1587
// Creates a div, adds each option as an individual input inside it.
1585
1588
// If already given with a containerEl, will search for all input[radio]
@@ -1611,8 +1614,9 @@ p5.prototype.createRadio = function(...args) {
1611
1614
self = addElement ( radioElement , this ) ;
1612
1615
this . elt = radioElement ;
1613
1616
}
1614
- self . _name = name || 'radioOption' ;
1615
1617
1618
+ // Generate a unique name for each radio group if not provided
1619
+ self . _name = name || `radioOption_${ counter ++ } ` ;
1616
1620
// setup member functions
1617
1621
const isRadioInput = el =>
1618
1622
el instanceof HTMLInputElement && el . type === 'radio' ;
You can’t perform that action at this time.
0 commit comments