# Checkbox switch Question Updated

**URL:** <https://discourse.processing.org/t/checkbox-switch-question-updated/28826>\
**Category:** Coding Questions\
**Created:** [March 25, 2021, 9:31am UTC](https://discourse.processing.org/t/checkbox-switch-question-updated/28826 "2021-03-25T09:31:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mem](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@Mem](https://discourse.processing.org/u/Mem)\
**Post date:** [March 25, 2021, 9:31am UTC](https://discourse.processing.org/t/checkbox-switch-question-updated/28826/1 "2021-03-25T09:31:56Z")

</div>

Hi,

I would like to be able to select different circle A and B with a createCheckbox()

What I want is when the A is selected then we select the B, the circle A should disappear and the checkbox A must be unchecked

Right now when I check the A then I check the B the A remain checked

What is wrong with my code?

Thank you for your help

Here is the exemple :

var checkbox\_a, checkbox\_b;

var checkbox\_a\_go, checkbox\_b\_go;

function setup() {

createCanvas(400, 400);

checkbox\_a = createCheckbox(“A”, false);

checkbox\_a.position(20, height + 20);

checkbox\_a.changed(aaa);

checkbox\_b = createCheckbox(“B”, false);

checkbox\_b.position(60, height + 20);

checkbox\_b.changed(bbb);

}

aaa = function(){

checkbox\_a\_go = !checkbox\_a\_go;

if(this.checked()){

//checkbox\_b\_go = false;

//checkbox\_c\_go = false;

}}

bbb = function(){

checkbox\_b\_go = !checkbox\_b\_go;

if(this.checked()){

//checkbox\_a\_go = false;

// checkbox\_c\_go = false;

}}

function draw() {

background(220);

if(checkbox\_a\_go === true){

ellipse(50,50,100,100)

}

if(checkbox\_b\_go === true){

ellipse(200,200,200,200)

}

}
