I have a form that is a revenue search filter. In this filter I have a checkbox group for the category:
<form method="get" action="/busca">
<h4>Categoria</h4>
<input type="checkbox" name="categoria[]" value="entrada"> Entrada
<input type="checkbox" name="categoria[]" value="principal"> Principal
<button type="submit">Buscar Receitas</button>
</form>
I wanted instead to appear the checkboxes, an image (svg) to click, and clicking on the image it marks the corresponding checkbox. I am using fontawesome library. Then the DIV that wanted it to be clickable would look like this:
<div class="categoria" id="entrada">
<i class="fas fa-apple"></i><br/>
Entrada
</div>
<div class="categoria" id="principal">
<i class="fas fa-utensils"></i><br/>
Principal
</div>
Then when you click on the divs, it selects the corresponding checkbox.
And one more item, when I click on the div, it changes the css class, to turn red for example. You could add the class ".click" and click again, remove this class.