jQuery Validation: How to not display errors? OR How to display errors as a tooltip?

I want my errors to float above, left-justified, the input field that doesn't validate. How can I do this?

If I can't, how can I turn the errors off? I still want the fields to validate (and highlight on error), but not for the actual error messages to display. I couldn't seem to find anything in the jQuery docs that would let me turn them on/off... ??


You want the errorPlacement option, and perhaps errorContainer and errorElement for further customization.

See http://docs.jquery.com/Plugins/Validation/validate#toptions

Use the errorPlacement property for your jQuery validation call, as J Cooper suggested:

    errorPlacement: function(error, element) {

And CSS to style the error (in your stylesheet, or to the individual elements):

label.error {
    /* Move the error above the input element. */
    position: absolute;
    line-height: 1.5em;
    margin-top: -1.5em;

    background-color: red;
    color: white;
    padding: 0 2px;

Need Your Help

Remove element if it has a certain attribute

javascript jquery

So if I wanted to remove all td elements with an attribute of style for instance, how could I do that? Would I need to loop through all td elements or is there another method?

C++: Safe way to cast an integer to a pointer

c++ casting dynamic-cast reinterpret-cast

I need to convert an integral type which contains an address to the actual pointer type. I could use reinterpret_cast as follows: