I have a single field inside of a Div with a label and its validation summary. It’s part a modal JQuery dialog:
<table>
.
.
.
<div id="user-date-add">
<tr>
<td width="100">
<div class="editor-label">
@Html.LabelFor(model => model.User.Date)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.User.Date)
@Html.ValidationMessageFor(model => model.User.Date)
</div>
</td>
</tr>
</div>
.
.
.
Depending on a certain condition inside of the JavaScript function I need to hide or show this section with the Date field and related data inside of that Div
So I tried:
if(condition)
{
$("#user-date-add").hide();
}
else
{
$("#user-date-add").show();
}
I also tried to utilize:
$("#user-date-add").trigger();
It doesn’t work. The field on the form doesn’t even blink. Is it because the div is rendered inside of the modal popup ? Or is it because there are input tags inside ?
By the way the Editor Date field appears as DatePicker.
How can I make this work ?
Thank you in advance.
Apparently having DIV tags inside of the table cells is not valid.
I removed the divs and added the ID to the actual row that I need to .Hide() / .Show().