JQuery Form Validation Error Placement

So, I basically want to do something like this: http://jsfiddle.net/bUV6S/1/ ...

But I want to do it using the validate.js. Is it possible to target multiple textboxes using:

            errorPlacement: function (error, element) {
                error.appendTo($("#textUsername"));
            }

...in some way? Thanks.

Answers


You can append to multiple elements like this:

error.appendTo("#textUsername, #textPassword");

Here is the documentation link for "Multiple Selectors": http://api.jquery.com/multiple-selector/

Here is a jsfiddle appending to multiple elements: http://jsfiddle.net/jasper/Wa8EA/


Need Your Help

How to use file_field_tag with carrierwave

html ruby-on-rails-4 file-upload carrierwave form-for

I was trying to optimise my project with helpers and faced a problem.

Delete SDK Message Processing Step from MS CRM Plugin

c# .net dynamics-crm-2013

I faced really strange limitation of the MS Dynamics CRM, that is not covered anywhere in documentation.