I have been attempting to create a drawing in p5.js that draws a circle when the selected radio button is clicked, but when I click a radio button, the drawing does not change.
Radio button html:
<input type="radio" name="radionbutton" value="1" id="button1"/>
<input type="radio" name="radionbutton" value="2" id="button"/>
Javascript:
var button1 = document.getElementById("button1");
var button2 = document.getElementById("button2");
function drawDonut() {
console.log("Redrawing our donut!");
background(218, 24, 132);
if (button1) {
fill(20, 20, 20);
circle(100, 100, 200);
} else if (button2) {
fill(70, 10, 100);
circle(10, 40, 50);
}
}
function setup() {
myCanvas = createCanvas(400, 400);
drawDonut();
}
I just need simple code and not too advanced, thank you.