Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4020870
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:16:54+00:00 2026-05-20T10:16:54+00:00

im using jquery with asp.net mvc. Im doing something like this so that the

  • 0

im using jquery with asp.net mvc.
Im doing something like this so that the submit button becomes disabled when clicked.

but if there are validation errors i dont want it to be disabled.

 $('form').submit(function () {
        if ($('form').valid()) {
            $('input[type=submit]', this).attr('disabled', 'disabled');
        }
    });

this makes it disabled, but even if there are validation errors.
whats wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:16:55+00:00Added an answer on May 20, 2026 at 10:16 am

    EDIT: i’ll try again after my first screw up 😛

    $('form').submit(function () {
            if ($('form').valid()) {
                $('input[type=submit]', this).attr('disabled', 'disabled');
            }
        });
    

    Maybe there are other forms on the page, and it’s validating the wrong one?

    $('form').submit(function () {
            if ($(this).valid()) {
                $(this).find('input[type=submit]').attr('disabled', 'disabled');
            }
        });
    

    oh and did you $(‘form’).validate() to enable validation (which I would guess is called automatically by MVC if you’re using MVC’s validation, but I’m not 100% sure about that)?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ASP.NET MVC 2. I have a modal dialog (done through jquery
I have an asp.net mvc calendar application (using jquery ui datepicker) and i am
Good morning, I'm learning MVC using the music store examples on the www.asp.net/mvc page,
Hi guys i know this is a known problem in ASP.NET MVC, basically what
Hopefully someone can help, I've been playing with ASP.NET MVC 2 for a learning
In my ASP.Net MVC View, I have a menu. The menu consists of a
Is there a function for ASP.NET MVC 2 built in data annotation javascript validation
I'm reading Steven Sanderson's book Pro ASP.NET MVC 2 Framework . In his book,
I am using a user control (.ascx) as below <div class=ui-widget id=w_instruction> <div class=ui-state-instruction
As a programmer my first instinct is to start coding, but then again chapter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.