1

I'm using the Labelify plugin to have a light grey label inside my text fields. The plugin uses the title attribute for the inside text. I'm also using the Validation plugin for validating that particular field.

When the validation fails, the validator produces an error, which it gets from the title attribute of that field as well. How would I make a custom error for that field rather than it automatically taking the title attribute?

0

2 Answers 2

1

try something like this

<tr>

    <td><input type="text" name="name" size="30"/>

    <p class="error"></p>

    </td>

</tr>

And in you validation portion

$('#category').validate({

    rules:{name: {required: true}},

    messages: {name: "Category name is required"},      

    errorPlacement: function(error, element){

            $(element).each(function (){

            $(this).parent('td').find('p.error').html(error);

        });

}}) 

Where #category is a form id

Sign up to request clarification or add additional context in comments.

Comments

0

Are you looking for something like this: Jquery Validation plug-in custom error placement

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.