We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I've used createRadio() in my setup() to create a series of radio buttons with three options. Can I specify one of the radio buttons being checked by default? Is this something I can do in the js or in the html?
Answers
You can do it in your setup().
You are supposed to be able to pass a parameter to the .value() function to set a given radio button as checked too (according to the p5.js source, at least), but I couldn't get it to work!
Like, this should work:
But doesn't...?
https://github.com/processing/p5.js/blob/5e1aa5d28371f9bc07ee1d4930d33a04d4bd2481/lib/addons/p5.dom.js#L760
TFGuy44,
This is nuts, but I have the exact opposite results from you. Your setup() example doesn't work for me, but passing a parameter into the .value() does work. Wha...?
Regardless, you have solved my issue. TY TY TY.
HRMMRMRM... Okay!
To be fair, I was just trying it using the EDIT button on this page:
https://p5js.org/reference/#/p5/createRadio
But since you got it working, no worries!