jquery validate poshytip 自訂樣式

來源:互聯網
上載者:User

最近項目中做了一個jquery.validate氣泡提示。
好像最新版的jquery.validate中,有這個功能,但在我這裡不怎麼好用。
就自己加了一個。
找了一些外掛程式qtip2的樣式不錯,但我本地顯示不出來呀。他本身也有jquery.validate的例子。但樣式在我這裡不顯示呀。好像是jquery版本的問他,用他的jquery就可以顯示。用我的就不行坑爹。放棄。
poshytip-1.1這個,樣式還不錯!
positionX,positionY是提示顯示的位置。
複製代碼 代碼如下:
$(document).ready(function () {
// validate the comment form when it is submitted
var myForm = $('form:first');
myForm.validate({
onkeyup: false,
success: function (element) {
var elem = $(element);
elem.poshytip('disable');
elem.poshytip('destroy');
},
errorPlacement: function (error, element) {
var elem = $(element);
if (!error.is(':empty')) {
//右:x=right;y=center
//左:x=left;y=center
//上:x=inner-left
//下:x=center;y=bottom
var aX = "center";
if (elem.attr("positionX") != null) {
aX = elem.attr("positionX");
}
var aY = "bottom";
if (elem.attr("positionY") != null) {
aY = elem.attr("positionY");
}
elem.filter(':not(.valid)').poshytip({
content: error,
alignTo: 'target',
alignX: aX,
alignY: aY,
offsetX: 0,
offsetY: 5
});
} else {
elem.poshytip('disable');
elem.poshytip('destroy');
}
}
});
});

存在問題
onkeyup不可以為 ture,因為這樣,有些驗證,氣泡會一直存在。這個不科學。大家有什麼好的辦法沒?

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.