lundi 22 mai 2017

jQuery sort checkboxes inside div's based on value

I have a couple of checkboxes being generated by a plugin in Wordpress. I don't have the option to sort these checkboxes so I would like to have them sorted based on their value, with the highest first.

the HTML generated looks like this:

<div class="wpgmza_filter_container" id="wpgmza_filter_container_5">
        <div class="wpgmza_cat_checkbox_holder wpgmza_cat_checkbox_5">
            <div class="wpgmza_cat_checkbox_item_holder_first">
                <input type="checkbox" class="wpgmza_checkbox form-control" id="wpgmza_cat_checkbox_0" name="wpgmza_cat_checkbox" mid="5" value="0">
                <div>
                    <label for="wpgmza_cat_checkbox_0">All</label>
                </div>
            </div>
            <div class="wpgmza_cat_checkbox_item_holder">
                <input type="checkbox" class="wpgmza_checkbox form-control" id="wpgmza_cat_checkbox_1" name="wpgmza_cat_checkbox" mid="5" value="1">
                <div>
                    <label for="wpgmza_cat_checkbox_1">Airco</label>
                </div>
            </div>
            <div class="wpgmza_cat_checkbox_item_holder">
                <input type="checkbox" class="wpgmza_checkbox form-control" id="wpgmza_cat_checkbox_2" name="wpgmza_cat_checkbox" mid="5" value="2">
                <div>
                    <label for="wpgmza_cat_checkbox_2">Vent</label>
                </div>
            </div>
        </div>
    </div>




Aucun commentaire:

Enregistrer un commentaire