I want to click by checking checkbox, but the TextBox is not showing my datepicker and need some help, there are not javascript error. What could be the reason for this? Here is my logic below
$(document).ready(function() {
// bind an event with checkbox on click. On click function onClickCheckBox will be called.
$('#Lockuntil').on('click', onClickCheckBox);
// to hide or show on page load.c
onClickCheckBox();
});
// logic to show hide textbox based on checkbox's value
function onClickCheckBox() {
if ($('#Lockuntil').is(":checked")) {
$("#TextValue").show();
} else {
$("#TextValue").hide();
}
}
<div class="row">
<div class="form-group">
<div class="col-sm-2">
@Html.CheckBoxFor(model => model.Lockuntil, new { @class = "rb", id = "Lockuntil" })
@Html.TextBoxFor(model => model.TextValue, new { @class = "datepicker", id = "TextValue" })
</div>
</div>
</div>