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

  • SEARCH
  • Home
  • 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 8050461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:05:44+00:00 2026-06-05T07:05:44+00:00

This is actually related with ASP.NET MVC. When a form is submitted, model validation

  • 0

This is actually related with ASP.NET MVC.

When a form is submitted, model validation is performed. If an error is detected, the error message will display in a <span>. We should be able to get hold of it using jQuery, by $('span.field-validation-error'). But what event should we bind to for this “OnCreated”?

I have tried $('span.field-validation-error').change(function (e) {, $('span.field-validation-error').load(function (e) { etc. But none of them worked.

So what is the correct event name?

—-Update—-

Our goal is to customize the error message displayed. If it is possible to edit that <span> tags when they are created, we will be able to display an exclamation mark icon and place those error messages in the tooltip, for example.

  • 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-06-05T07:05:45+00:00Added an answer on June 5, 2026 at 7:05 am

    I GUESS you could:

    var checkTimer = setInterval(function() {
            if ($('span.field-validation-error').length > 0) {
                //yay :D it exists!
                alert("YEP");
                clearInterval(checkTimer);
            } else {
                //derp...    
                console.log("nope");
            }
    }, 50);
    setTimeout(function() {
        document.body.innerHTML = "<span class='field-validation-error'>word</span>";
    }, 5000);​
    

    Example:
    http://jsfiddle.net/neuroflux/Ynz5b/1/

    [edit] Yes… it’s messy, I hate timers and intervals – but this is one way to do it…

    [edit 2] Reference for checking if elements exist: http://aaronrussell.co.uk/legacy/check-if-an-element-exists-using-jquery/

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

Sidebar

Related Questions

This question relates to ASP.NET MVC 2 RC (December drop). The basic problem is
I've never used any Mock frameworks and actually new to ASP.NET MVC, testing and
This is actually related to another question I had that was already answered. That
If I use INT(12) vs INT(10) or INT(8) what will this actually do in
Actually I don't know whether my question is related to this thread. I want
Actually I am trying to learn jQuery Ajax calls to asp.Net webservices. I have
I'm building an ASP.NET MVC site using the ADO.NET Entity Framework. I have an
hey there - I'm trying to use asp.net mvc for some things as usual,
Today I've got confused with 2 issues related to the HttpApplicationState of ASP.net. My
Yesterday I was having fully compiled ASP.NET MVC 3.0 project. Today when i opened

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.