在jQuery选择菜单中选择下一个选项 [英] select next option in jquery selectmenu
本文介绍了在jQuery选择菜单中选择下一个选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
试图创建一个按钮,该按钮将转到分配了$ selectmenu的选择菜单中的下一个选项.
trying to create a button that will goto the next option in a selectmenu that has $selectmenu assigned to it.
$('option:selected', 'select').removeAttr('selected').next('option').attr('selected', 'selected');
在标准的HTML选择菜单上工作,但在为其分配了$ querymenu的情况下则无法使用.
works on a standard HTML select menu but not when it has the jquery $selectmenu assigned to it.
$('select#toolMenu').selectmenu({
style:'popup',
width: 600,
menuWidth: 600,
maxHeight: 400,
format: addressFormatting,
change: function () {
var val = this.value;
window.location=val;
}
});
我知道如何控制选择菜单吗?
any idea how i can control the selectmenu?
任何帮助表示赞赏...
any help appreciated...
丹.
推荐答案
因为菜单旨在为每个选项加载新页面,所以我只是抓住了原始选项val()并转到菜单将自动出现的下一页重新启动dom.
as the menu was meant to load a new page for each option i just grabbed the original option val() and went to the next page where the menu would automatically re-initiate with the dom.
jqueryMenu()
$('a.previous').click(function(){
val = $('option:selected', 'select').previous('option').val();
window.location=val;
})
$('a.next').click(function(){
val = $('option:selected', 'select').next('option').val();
window.location=val;
})
这篇关于在jQuery选择菜单中选择下一个选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文