gpt4 book ai didi

jquery - JQuery 远程成功回调中不显示标签

转载 作者:太空宇宙 更新时间:2023-11-04 10:39:43 25 4
gpt4 key购买 nike

我想在进行远程 JQuery 验证成功回调后显示标签。但它似乎并没有执行代码。

这是我的代码。

$('#Location').rules("add", {
required: true,
//minlength: 5,
maxlength: 5,
messages: {
required: "Required input",
minlength: jQuery.validator.format("Please, {0} characters are necessary"),
maxlength: jQuery.validator.format("Please, {0} characters are necessary"),
remote: jQuery.validator.format("Could not locate zip code")
},
remote: {
url: "CheckLocation",
type: "post",
data: {
Location: function() {
return $('#Location').val();
},
success: function(data) {
//console.log(data);
$('#locationSuccess').attr('display', ''); // not working
}
}
}
});
<label id="locationSuccess" style="color: green; display: none">ahh, Somewhere</label>

最佳答案

使用 jQuery .show() 方法

$('#locationSuccess').show();

或.css()

$('#locationSuccess').css('display', '');

关于jquery - JQuery 远程成功回调中不显示标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35903749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com