mercredi 25 octobre 2017

Make click of non-label description text check/uncheck preceding form checkbox

Using CMS with very prescriptive components, and doesn't allow anything more than basic label on form checkboxes. Would like descriptive text in following div to also check/uncheck preceding checkbox using Javascript/JQuery. Example HTML:

<form>

<input id="chicken" name="food" class="" type="checkbox">
    <label for="chicken" class="checkbox">
        Chicken a la King
    </label>

<div class="desc" id="chicken-desc">
        A dish consisting of diced chicken in a cream sauce, and often with sherry, mushrooms, and vegetables, served over rice, pasta, or bread. 
</div>

</form>

See http://ift.tt/2gHgMGA

Solution that could handle multiple checkboxes simply would be even awesomer. Thanks!




Aucun commentaire:

Enregistrer un commentaire