原型中的相关选择
我有两个具有相同 的
有什么线索吗?有没有比记住最后选择的项目、重新创建选项数组、重新选择项目更好的方法?
谢谢!
I have two <select>s
with the same <option>s
, and I need - using prototype - that when selecting an option in one of them, the same option is removed from the other select and additionally the latter must mantain its previously selected option.
Any clues ? Is there a better way than remembering the last item selected, recreate the options array, an reselecting the item ?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以从另一个选择中“删除”该项目,但您需要通过其索引来指定它,并且您仍然需要记住所选项目,并在删除后重新计算其索引。所以它比重新创建数组稍微好一些,但也好不了多少。
You can 'remove' the item from the other select, but you need to specify it by its index, and you'll still need to remember the selected item, and recalculate its index after the removal. So it's slightly better than recreating the array, but not much better.