Показать/Скрыть текстовое поле после отправки
Hi, I have written my jquery like this - ''' <script type="text/javascript"> $(document).ready(function () { var IsUserVisible = '@Model.IsUserVisible'; $('#divUser').hide(); if (IsUserVisible == false) { $('#divUser').show(); } else { $('#divUser').hide(); } }); </script> ''' where the controls are - ''' <div class="line"> <div class="item" id="divEmail"> @Html.LabelFor(m => m.Email, "Email*", new { id = "email" }) @Html.TextBoxFor(m => m.Email, new { @class = Model.IsFormatted ? "errorClass k-textbox" : "k-textbox" }) </div> </div> <div class="line"> <div class="item" id="divUser"> @Html.LabelFor(m => m.Username, "User Name*", new { id = "user" }) @Html.TextBoxFor(m => m.Username, new { @class = Model.IsFormatted ? "errorClass k-textbox" : "k-textbox" }) </div> </div> <div class="line col_2 command"> @{var itemWidth = "100%";} <div class="item rightAlign" style="width:@(itemWidth)"> <input type="submit" value="CANCEL" id="CANCEL" class="vf-button1 button1" /> <input type="submit" value="SUBMIT" id="SUBMIT" class="vf-button button2" /> </div> </div> ''' I have to show the #divUser on the basis of some result after submit. I assigned my model inside post like - if (some logic) { model.IsUserVisible = true; return View(model); } ''' But after submitting the username texbox is not going to be visible. Please suggest.
Что я уже пробовал:
<pre>Hi, I have written my jquery like this - ''' <script type="text/javascript"> $(document).ready(function () { var IsUserVisible = '@Model.IsUserVisible'; $('#divUser').hide(); if (IsUserVisible == false) { $('#divUser').show(); } else { $('#divUser').hide(); } }); </script> ''' where the controls are - ''' <div class="line"> <div class="item" id="divEmail"> @Html.LabelFor(m => m.Email, "Email*", new { id = "email" }) @Html.TextBoxFor(m => m.Email, new { @class = Model.IsFormatted ? "errorClass k-textbox" : "k-textbox" }) </div> </div> <div class="line"> <div class="item" id="divUser"> @Html.LabelFor(m => m.Username, "User Name*", new { id = "user" }) @Html.TextBoxFor(m => m.Username, new { @class = Model.IsFormatted ? "errorClass k-textbox" : "k-textbox" }) </div> </div> <div class="line col_2 command"> @{var itemWidth = "100%";} <div class="item rightAlign" style="width:@(itemWidth)"> <input type="submit" value="CANCEL" id="CANCEL" class="vf-button1 button1" /> <input type="submit" value="SUBMIT" id="SUBMIT" class="vf-button button2" /> </div> </div> ''' I have to show the #divUser on the basis of some result after submit. I assigned my model inside post like - if (some logic) { model.IsUserVisible = true; return View(model); } ''' But after submitting the username texbox is not going to be visible. Please suggest.