如何动态选择jQuery ui selectmenu中的选项? [英] How to select an option in a jQuery ui selectmenu dynamically?

查看:147
本文介绍了如何动态选择jQuery ui selectmenu中的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将菜单从常规选择更改为jQuery选择菜单后,我无法再以编程方式选择其中的选项.有办法吗?

After changing a menu from a regular select to a jQuery selectmenu, I can no longer select options in it programatically. Is there a way to do this?

要选择的代码是(假设ListId是列表的实际ID)

The code to select is (assuming ListId is the actual Id of the list)

$('#ListId').val(value);

插件的激活方式如下:

$("#ListId").selectmenu({ style: "dropdown", width:140 });

有没有办法在选择菜单中选择一个项目?调用相同的.val(value)函数只是在隐藏的原始选择列表中选择值,而不是样式精美的jQuery selectmenu.

Is there a way to select an item in the select menu? Calling the same .val(value) function just selects the value in the hidden original select list, not the nicely styled jQuery selectmenu.

推荐答案

$('#ListId').selectmenu("value", value);

这篇关于如何动态选择jQuery ui selectmenu中的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆