i have textbox(it gets integer value) on page , set "0" textboxes script @ startup.
<script> $(document).ready(function () { $('.myclass').each(function () { this.value = this.value || "0"; }); }); </script> also textbox looks like:
@html.textboxfor(model => model.answers[i].answer, new { @style = "width:45px; margin-left:10px; margin-bottom:10px; text-align:center;", @class="myclass" }) @html.validationmessagefor(model => model.answers[i].answer) how can set null value after validation after postback? because script set 0 value textbox after every postback?
thanks help.
<script> $(document).ready(function () { $('.myclass').each(function () { this.value = this.value || ""; }); }); </script> if use script above empty textbox. not null value, want.
you should better disable it:
<script> $(document).ready(function () { $('.myclass').each(function () { this.attr('disabled', true); }); }); </script>
Comments
Post a Comment