javascript - mvc 3 razor cannot clear form value with validation class -
i'm using mvc 3 razor , using unobtrusive client validation. things working great, want able reset form if user decides wants start on or cancel action. seems there lot of meta data attached each form element when using validation.
<input type="text" value="" name="user.firstname" id="user_firstname" data-val-required="the first name field required." data-val-length-max="50" data-val-length="the field firstname must string maximum length of 50." data-val="true" class="text-box single-line">
the jquery snippet here shows problem. when try manually reset value of text field, other javascript intercepting execution after clear value , sets was:
$("#btnreset").click(function () { alert($("#user_firstname").val()); $("#user_firstname").val(""); alert($("#user_firstname").val()); });
i'm looking pointers here on how clear form values when user clicks button. seems such simple task, can find no documentation how accomplish , haven't found here or elsewhere help.
i using html input of type reset rather button type. reset should not have been used in case.
Comments
Post a Comment