mardi 26 avril 2016

How to disable textbox when checkbox is checked using Laravel and AdminLTE?

do you know how to disable textbox when the checkbox is checked? This code below is worked when I am using Laravel 5 only. But when I am integrating it with AdminLTE, this won't worked.

<div class="form-group">
        <script type="text/javascript">
            $(function () {
                $("#unlimited").click(function () {
                    if ($(this).is(":checked")) {
                        $("#masa_berlaku_from").attr("disabled", "disabled");
                        $("#masa_berlaku_to").attr("disabled", "disabled");
                    } else {
                        $("#masa_berlaku_from").removeAttr("disabled");
                        $("#masa_berlaku_to").removeAttr("disabled");
                    }
                });
            });
        </script>
        <label for="masa_berlaku" class="control-label col-sm-2">Masa Berlaku</label>
        <div class="col-md-3">
            <input class="form-control" data-provide="datepicker" data-date-format="yyyy-mm-dd" name="masa_berlaku" id="masa_berlaku_from" placeholder="from">
        </div>
        <div class="col-md-3">
            <input class="form-control" data-provide="datepicker" data-date-format="yyyy-mm-dd" name="masa_berlaku" id="masa_berlaku_to" placeholder="to">
        </div>
        <div class="col-md-3">
            <div class="checkbox">
                <label>
                    <input type="checkbox" name="masa_berlaku" value="0000-00-00" id="unlimited"> Unlimited
                </label>
            </div>
        </div>
    </div>




Aucun commentaire:

Enregistrer un commentaire