未捕获的错误:selectmenu小部件实例没有这种方法“值" [英] Uncaught Error: no such method 'value' for selectmenu widget instance

查看:137
本文介绍了未捕获的错误:selectmenu小部件实例没有这种方法“值"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了1.10版本的jQuery,并且在尝试使用selectmenu小部件设置值时总是遇到此错误.

I've installed the 1.10 version of jQuery and I am getting this error when trying to set the value as the way I've always done so with the selectmenu widget.

错误:未捕获的错误:selectmenu小部件实例没有这种方法值"

Error: Uncaught Error: no such method 'value' for selectmenu widget instance

$('select.widthOpts').selectmenu('value', wDims.feet);

尝试设置选择菜单的索引时,我也会收到相同的错误.

I also receive the same error when attempting to set the index of the selectmenu.

推荐答案

您知道有两个版本吗?

https://github.com/fnagel/jquery-ui/(旧的,灯丝组工作叉) https://github.com/jquery/jquery-ui/tree/selectmenu (新的,官方的)

https://github.com/fnagel/jquery-ui/ (old, fork of filament groups work) https://github.com/jquery/jquery-ui/tree/selectmenu (new, official)

新方法没有值或索引方法.

The new one does not have value or index methods.

由于出现错误,我认为您正在使用新版本.

Since you are getting error, I reckon you are using new version.

所以您应该使用$('select.widthOpts').selectedIndex=index; 其中index是一个整数值,您已经知道selectmenu中所需选项的位置

So you should use $('select.widthOpts').selectedIndex=index; where index is a integer value that you already know the position of the required option in selectmenu

这篇关于未捕获的错误:selectmenu小部件实例没有这种方法“值"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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