gpt4 book ai didi

jquery - 从数组值旋转 jquery ui spinner

转载 作者:行者123 更新时间:2023-12-01 03:12:07 24 4
gpt4 key购买 nike

有人尝试过使用使用数组作为源数据的 jQUery UI Spinner 吗?基本上我真正想要实现的是我有一个数据列表(在带有字符串值的数组中),我希望我的旋转器仅使用这些数组值旋转。希望有人能告诉我该怎么做。

最佳答案

好吧,我想我要回答我自己的问题,只是为了其他可能有同样问题的人。

var dlist = ['banana','papaya','apple']
$( ".spinner" ).spinner({
min: 0,
max: 2,
create: function(){
$(this).parent().append('<input class="spinner-text" value="'+dlist[$(this).val()]+'">');
},
stop: function(event,ui) {
$(this).siblings('.spinner-text').val(dlist[$(this).val()]);
}
});

你可以在 here 中看到我是如何做到的

关于jquery - 从数组值旋转 jquery ui spinner,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25981586/

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