1

我正在使用 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"   
    }
});

干杯德布拉德

4

1 回答 1

0

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

errorPlacement: function(error, element) {
    element.searchforyoutsmall.html(error;
},
于 2011-02-10T11:16:57.413 回答