开发者

Using jQuery Labelify + jQuery Validation

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 us开发者_如何学JAVAing 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?


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜