I have a simple MVC4 form with client validation :
@{ Html.EnableClientValidation(); } @{ Html.EnableUnobtrusiveJavaScript(); } @using (Html.BeginForm("Search", "Search", FormMethod.Post, new { id = "frmMain" })) { @Html.AntiForgeryToken() ..... <input type="submit" value="Search" id="btnSubmit" />
When the user clicks the submit button and all the checks on the client , I want the submit button to be disabled according to jQuery below. How do I know if a client-side check has passed on a jQuery script side?
<script type="text/javascript"> $(document).ready(function () { $('input[type=submit]').click(function (e) { $(this).attr('disabled', true); $(this).attr('value', 'Working'); $('#frmMain').submit(); }); });
source share