vendredi 28 octobre 2016

Javascript add/remove textbox when checking/unchecking a checkbox (Razor HTML)

I have this checkbox, and I want to add a textbox and label when it is checked and hide them when it becomes unchecked. how would one go about doing that with JS or Jquery ?

<div class="form-group">
        @Html.LabelFor(model => model.OwnVehicle, "Eget Køretøj", htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.CheckBoxFor(model => model.OwnVehicle, new { htmlAttributes = new { @class = "form-control"} })
            @Html.ValidationMessageFor(model => model.OwnVehicle, "", new { @class = "text-danger" })
            <div id="holder">


            </div>
        </div>
    </div>




Aucun commentaire:

Enregistrer un commentaire