I would like to know how I can use javascript to change the color of the button after it has been clicked; that is, below in the code has 2 formats. If you click on the A1 format, the button where the div is will change color and the color will change indicating that the format is selected; then, if you click the other button, you will disable A1 and activate the color in A2. How can I do this using javascript, and should this be done with multiple items?
<div onclick="document.getElementById('A1').style.display='block';document.getElementById('A2').style.display='none';">Formato 1</div><div onclick="document.getElementById('A1').style.display='block';document.getElementById('A2').style.display='none';">Formato 2</div>
<div id="A1" style="display:block;">Conteudo oculto 1</div>
<div id="A2" style="display:none;">Conteudo oculto 1</div>
Well thanks for the solution with the code below but now just to finish how can I make the code below work with several items at once because I need it to work with several items on the same page.
<div>Item 1</div>
<div id="formato1">Formato 1</div>
<div id="formato2">Formato 2</div>
<div id="A1" style="display:block;">Conteudo oculto 1</div>
<div id="A2" style="display:none;">Conteudo oculto 2</div>
<div>Item 2</div>
<div id="formato1">Formato 1</div>
<div id="formato2">Formato 2</div>
<div id="A1" style="display:block;">Conteudo oculto 1</div>
<div id="A2" style="display:none;">Conteudo oculto 2</div>
<div>Item 3</div>
<div id="formato1">Formato 1</div>
<div id="formato2">Formato 2</div>
<div id="A1" style="display:block;">Conteudo oculto 1</div>
<div id="A2" style="display:none;">Conteudo oculto 2</div>