One of the elements in my project is a checkbox:
<div class="checkbox">
<label>
<?= Html::checkbox('chocolate', false) ?>
Chocolate
</label>
</div>
In addition to that, I also have a span tag:
<span>I enjoy all things chocolate.</span>
I am looking to incorporate either the onchange JavaScript function or jQuery (as I am fairly new to using jQuery) to display the span when the user checks the checkbox.
Initially, I need to retrieve the value of chocolate
. However, it is not JavaScript code, it is PHP code:
<?= Html::checkbox('chocolate', false) ?>
.