使用像 Spinner 这样的 jquery 增加文本输入的值
尝试使用 Jquery 创建一个简单的旋转效果,即两个按钮(向上和向下)和一个文本字段。向上按钮增加值,向下按钮减少值。增量步骤 + 或 - 1.
ui.spinner 的任何建议都是最明确的。不工作,我是 jquery 新手。一定是这样的 $(#up).click (function ( /*SOMETHING GOES IN HERE but what?*/ ))
对于 #down 也是如此。两者都可以设置调整输入文本字段,如上面所说的 id #test 。
Trying to create a simple spinner effect with Jquery, i.e. two buttons (up & down) with a text field. The upbutton increases the value while the down button decreses the value. increment steps + or - 1.
Any suggestions as ui.spinner is most def. not working and I am new to jquery. musty be something like$(#up).click (function ( /*SOMETHING GOES IN HERE but what?*/ ))
and likewise for #down. both to set adjust the input text field say id #test as above.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
演示:http://jsbin.com/akiki
Demo: http://jsbin.com/akiki
看看这个演示 - 我发现这是我尝试过的所有演示中最好的,
特别是如果您使用 jquery ui 主题
http://btburnett.com/spinner/example/example.html
Have a look at this demo - I have found that this works the best of all the ones I've tried
Especially if you are using jquery ui themes
http://btburnett.com/spinner/example/example.html
也许是这样的:
Maybe something like:
使用 @rfunduk 的基本代码我创建了这个:
With the base code by @rfunduk I created this: