动态依赖选择菜单 [英] Dynamic dependent select menus
问题描述
我使用在网上找到的jquery脚本创建了一个动态相关菜单. 然后,我使用众所周知的jquery.uniform脚本设置菜单样式. 您可以在此处查看外观: http://jsfiddle.net/Bs5Db/50/.
I have created a dynamic dependent menu using a jquery script i found on the web. And then i styled the menus using the well known jquery.uniform script. You can see how that looks like here: http://jsfiddle.net/Bs5Db/50/.
该代码的唯一功能是,一旦您从一个州选择了一个县然后切换到另一个州,最后选择的县的名称将保留在选择菜单中.
The only disfunction of that code is that once you select a county from one state and then you switch to another state,the name of the last county selected remains appended in the select menu.
我希望有一些jquery经验的人看一下代码,并给出一些建议,使每次第一个菜单更改时,如何使县选择菜单具有正确的值.
I hope someone with some jquery experience takes a look at the code and gives some advice of how to make the counties select menu have the right value everytime the first one is changed.
我自己很生气,但是没有运气! 提前感谢!
I exxperimented a liitle myself but with no luck! Thanx in advance!
推荐答案
您只需要更新统一插件即可.
You just need to update the uniform plugin.
$.uniform.update();
因此在drop_down_list()函数中,在显示它之前. 因此,在此之后插入:
So within drop_down_list() function right before you show it. So insert after this:
$('#loading_county_drop_down').hide(); // Hide the Loading...
这是jsfiddle更新的.您唯一的问题是选项太长,无法进入第二行.
Here is the jsfiddle updated. Your only problem is that the options are too long and goto second line.
这篇关于动态依赖选择菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!