jeudi 18 février 2016

Uncheck a group of check buttons

I'm trying to uncheck a group of check buttons in an onclick event:

HTML:

 </div>
            <button onclick="getChart(); uncheck();" type="submit" class="btn btn-default" id="refreshChart">Request</button>
        </div>

            <form class="form">
                <div class="btn-group btn-group-justified " data-toggle="buttons" name="chartSelect">
                    <label class="btn btn-info" id ="hide">
                        <input name="hide" type="checkbox" ><span>Hide</span>
                    </label>
                    <label class="btn btn-info">
                        <input name="total" id="total" type="checkbox">Total
                    </label>
                    <label class="btn btn-info">
                        <input name="max" id="max" type="checkbox">Max
                    </label>
                    <label class="btn btn-info">
                        <input name="mean" id="mean" type="checkbox">Mean
                    </label>
                    <label class="btn btn-info">
                        <input name="min" id="min" type="checkbox">Min
                    </label>
                    <label class="btn btn-info">
                        <input name="extrapo" id="extrapolation" type="checkbox">Extrapo
                    </label>
                    <label class="btn btn-info">
                        <input name="all" id="all" type="checkbox">All
                    </label>
                </div>
            </form>

I'm even just trying to just get one button to uncheck with no success.

JS:

function uncheck() {
    if ($('[name=max]').is(':checked')) {
        $('[name=max]').attr('checked', false);
    }
}




Aucun commentaire:

Enregistrer un commentaire