带有字符串作为输入的jQuery Spinner [英] jquery spinner with strings as input
本文介绍了带有字符串作为输入的jQuery Spinner的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我进行了搜索,但没有找到这样的解决方案.是否可以用jquery创建一个微调器,它使用文本值(字符串)而不是数字作为输入,或者换句话说,与此
Hi I searched but i didn't find such solution.Is it possible to create a spinner with jquery which has text values (strings) as input instead of numbers.Or in other words the same as this http://jsfiddle.net/yaQSP/ but instead ..-1,0,1.. to spin text values from list or array of strings.
推荐答案
更新
只需清理一下 http://jsfiddle.net/yaQSP/25/
请参阅: http://jsfiddle.net/yaQSP/23/
您可以这样做,例如:创建阵列.
You could do it a bit hacky like this: Create your Array.
设置:
$('#spinner').spinner({
step: 1,
numberformat: "n"
});
并在输入字段上绑定一个更改事件.然后这样称呼它->
and bind an change event on the input field. Then call it like this ->
yourArr[i]
而i
是输入字段的值.
这篇关于带有字符串作为输入的jQuery Spinner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文