During user logging, do you click on the class and text of the process change button?

advertisements

I have a login form

    @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
    {
        .....
        .....            

        <input type="submit" value="Log in" class="btn btn-primary" />

        <p>
            @Html.ActionLink("Register", "Register") if you don't have a local account.
        </p>
    }
</section>

While the process of logging in is running in background, what should I do to change the button class and text. For example, change button class to btn btn-info and text to Logging in...

Should I change the way I have created my Form (using Html Helpers)?


1 Give some name or id to your submit button, e.g "btnLogin"

2 Use jQuery to bind the click event of this button like following:

$("#btnLogin").click(function(){
    $(this).toggleClass("btn btn-info").val("Logging in...");
});

I haven't used any code editor to check my code but I hope it will give you a good idea.