[英]How to display the jquery validation error message in popup?
我想在彈出窗口中顯示郵政編碼字段錯誤消息。 不需要彈出的其他字段錯誤消息。我使用了以下代碼。 這個怎么解決。
$(document).ready(function() {
$("#conference_form").validate({
rules: {
conpostcode: {
required: true,
minlength: 4,
remote: {
url:"<?php echo base_url() ?>tools/check_postcode/1",
type: "post",
data:
{
postcode: function()
{
return $('#conpostcode').val();
}
},
}
},
name: "required",
address: "required",
date: "required",
description:"required",
},
messages: {
conpostcode: "We don't have service this location, Please call us +44 12345454, for stock sets support.",
name: "Please enter venu name",
address: "Please enter address",
date: "Please enter date",
description: "Please enter description",
}
})
});
如何僅在警報或彈出窗口中顯示郵政編碼錯誤消息。 請任何人幫助。
使用errorPlacement
選項
errorPlacement(默認:將錯誤標簽放置在無效元素之后) 類型:Function() 自定義創建的錯誤標簽的放置。 第一個參數:作為 jQuery 對象創建的錯誤標簽。 第二個參數:作為 jQuery 對象的無效元素。
errorPlacement: function(error,element){
//error.insertAfter(element);
//use error.html() as content in your popup div or simply
alert(error.html());
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.