使用jQuery Uniform.js更改选择值 [英] Change Select value using jQuery Uniform.js

查看:452
本文介绍了使用jQuery Uniform.js更改选择值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用uniform.js进行jQuery,我需要以编程方式更改select项的值。它似乎改变了实际的< select>字段,但统一元素不会改变。除了手动查找选项的HTML,然后将uniform元素设置为该值之外,执行此操作的正确方法是什么?

I'm using uniform.js for jQuery and I need to change the values of the select item programmatically. It seems to change the actual <select> field, but the uniform element doesn't change. What is the proper way to do this, other than manually looking up the HTML for the option, then setting the uniform element to that value?

推荐答案

像往常一样设置值后,
你需要告诉制服更新元素。

After setting the value as usual, you need to tell uniform to update the element.

$.uniform.update("#myUpdatedSelect");

或者正如文档所说,如果你很懒,你可以让它更新所有元素

or as the documentation says, if you are lazy you can let it update ALL elements

$.uniform.update();

这篇关于使用jQuery Uniform.js更改选择值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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