jquery验证,错误放置

时间:2011-02-10 10:54:37

标签: jquery validation placement

我正在使用Bassasistance jQuery验证,到目前为止它看起来很棒!我有一个关于错误放置的快速问题。

目前,正如下面所示,我正在瞄准[small]标签,我还将其用作用户应在字段中输入内容的提示。如果验证失败,我想用脚本中的相关消息替换当前的硬编码内容。当验证失败时,看起来它只是在我自己的

下添加另一个元素

任何想法都会很棒!

该网页可在http://www.st-patricks-day-2011.com/addlisting.asp

在线找到

这是我正在使用的代码

$("#paradeEventForm").validate({
    errorElement: "small",

    rules: {
        name: "required",
        description: "required",
        keywords: "required",
        address: "required",
        country: "required",
        eventDate: "required",          
        websiteAddress: "required"
        },

    messages: {
        name: "Please enter a title for your Parade or Event",
        description: "Please enter a description for your Parade or Event",
        keywords: "Please enter some keywords that describe your Parade or Event",
        address: "Please enter the starting point of your Parade or Event",
        country: "Please enter the country where your Parade or Event is taking place",
        eventDate: "Please enter a date for your Parade or Event",          
        websiteAddress: "Please enter the website address of you Parade or Event"   
    }
});

欢呼声 Decbrad

1 个答案:

答案 0 :(得分:0)

如果我理解了您的问题,您可以尝试替换errorPlacement中的小内容:

errorPlacement: function(error, element) {
    element.searchforyoutsmall.html(error;
},