J'ai utilisé les champs d'aide html ci-dessous, mon problème, j'ai besoin de rendre ces éléments cachéspour pas caché lorsque la case est cochée.MVC html helpers change caché pour les attributs
@Html.HorizontalFormFieldFor(model => model.InsaatHizmetBedeli)
<div class="control-group">
@Html.LabelFor(model => model.tadilatMi, new { @class = "control-label" })
<div class="controls">
@if (!Model.tadilatMi.HasValue)
{
Model.tadilatMi = false;
}
@Html.CheckBoxFor(model => model.tadilatMi.Value, new { @Name="tadilatmi" });
</div>
</div>
@Html.HiddenFor(model => model.myHiddenProperty)
ici est mon code jquery:
$("input[name='tadilatmi']").on("change", function() {
if ($("input[name='tadilatmi']").is(":checked")) {
$("#myHiddenProperty").show()
}
})
Bien sûr, il ne travaille pas .. comment puis-je y parvenir?