Hi.
Is it possible to change the name of a button programmatically?
Something like:
button = createButton("one");
button.position(0, 0);
button.mousePressed(changeName);
function changeName() {
button.value = "two"; // ??
}
Hi.
Is it possible to change the name of a button programmatically?
Something like:
button = createButton("one");
button.position(0, 0);
button.mousePressed(changeName);
function changeName() {
button.value = "two"; // ??
}
Thanks, that works!
let toggle = true;
function setup() {
createCanvas(100, 100);
button = createButton("one");
button.position(0, 0);
button.mousePressed(fnc);
}
function draw() {
background(220);
}
function fnc() {
if (toggle) button.html('two');
else button.html('one');
toggle =! toggle;
}