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.
I GUESS you could:
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/