如何链接未定义数量的输入类型=“隐藏” JQuery UI 的某个进度条?
我需要将未定义数量的输入 type="hidden" 链接到 JQuery UI 的某个进度条(http://jqueryui.com/demos/progressbar/)。对于我使用的每个用户,我从来没有相同数量的隐藏条和进度条。 (如果我有 5 个用户,我将有 5 个进度条和 5 个隐藏)
我想知道我如何动态检测输入类型=“隐藏”和进度条的数量并链接它们。
谢谢
I need to link an undefined number of input type="hidden" to some progress bar of JQuery UI (http://jqueryui.com/demos/progressbar/). I never have the same number of hidden and progress bar for each user i use. (If i have 5 user, i will have 5 progress bar and 5 hidden)
I would like to know how could i, dynamically, detect the number of input type="hidden" and progress bar and link them.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是你想要的吗?
示例: http://jsfiddle.net/william/LZCqA/
Is this what you want?
Example: http://jsfiddle.net/william/LZCqA/
我不确定这是否是您正在寻找的...
如果您想选择隐藏类型的所有输入,最好的方法可能是在所有输入上设置一个类您感兴趣的输入,或者,如果您始终对页面上的每个隐藏输入感兴趣,则可以全部选择它们。
以下是如何执行每个操作的示例:
在本例中使用“.each”只是处理每个输入的示例。显然,只需执行 $('selector') 就会选择所有元素。
这有帮助吗?
小更新:
重新阅读您的问题后,这也可能有帮助...在您的 .each() 内,您可以轮询 jQuery 进度条并将隐藏输入设置为进度值酒吧。然而,我承认,我真的想不出您想要/需要这样做的情况。
I'm not real sure if this is what you're looking for...
If you're wanting to select all of the inputs of type hidden, the best way to do it would likely to be either set a class on all of the inputs you're interested in or, if you will always be interested in every hidden input on the page, you can just select them all.
Here are examples of how to do each:
Using ".each" in this case is just an example of working with every input. Just doing $('selector') will, obviously, select all of the elements.
Does that help?
Small Update:
After re-reading your question, this may help too... Inside your .each(), you could then poll your jQuery progress bar and set the hidden input to the value of the progress bar. However, I'll admit, I can't really think of a situation where you would want/need to do that.