jquery mobile selected option not updating on 'refresh'

橙三吉。 提交于 2019-12-03 21:42:26

Using jQuery 1.0.1 (latest stable version at this time) you can use .selectmenu('refresh') to refresh a select-widget.

$('select').empty().append('<option value="foo">Bar</option>').selectmenu('refresh');

Here is a demo: http://jsfiddle.net/4Thzt/

When you use $('select').selectmenu('refresh', true); (notice the , true), you are forcing the widget to not only be refreshed, but rebuilt, which will always show the placeholder text. Source: http://jquerymobile.com/demos/1.1.0-rc.1/docs/forms/selects/methods.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!