gpt4 book ai didi

javascript - 选择后使选择框不被选中

转载 作者:行者123 更新时间:2023-11-30 19:20:28 26 4
gpt4 key购买 nike

我正在使用一个 niceSelect 插件

https://github.com/hernansartorio/jquery-nice-select

这是我的代码,它运行良好,但我想在选择打开它的选项后重置它

$("#otherlogins").niceSelect();

$(document).on("change",".socialselection",function() {
var e = $(this);
var mode = $('div.nice-select.socialselection span.current').text();
if(e.val() == '') {
jAlert('warning', 'Please Choose the Service which you want to use for Login', 'Oops');
} else {
WinOpen('openlogin.cfm?mode='+ mode,'page');
e.attr('data-value') = ''; - This is throwing an error
}
});

最佳答案

您可以销毁并重新启动插件,如下所示:

$("#otherlogins").niceSelect();

$(document).on("change",".socialselection",function() {
var e = $(this);
var mode = $('div.nice-select.socialselection span.current').text();
if(e.val() == '') {
jAlert('warning', 'Please Choose the Service which you want to use for Login', 'Oops');
} else {
WinOpen('openlogin.cfm?mode='+ mode,'page');
$("#otherlogins").niceSelect('destroy');
$("#otherlogins").niceSelect();
//e.attr('data-value') = ''; - This is throwing an error
}
});

希望对你有帮助。

关于javascript - 选择后使选择框不被选中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57538109/

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