jQuery 移动端:在自定义的末尾添加关闭按钮 select

jQuery Mobile: Adding close button at end of a custom select

我正在尝试添加一个按钮以在其末尾关闭 select 菜单,因此对于很长的 select 菜单,您不必滚动回顶部。

这里可能看起来像 "Close this menu":http://jsfiddle.net/es0mxd3s/2/

另外我已经知道如何将其居中,但是每个 select 选项的更改都会丢失:

$('#company_characteristics-menu .ui-last-child a').removeClass('ui-btn-icon-right ui-checkbox-on').attr("style", "text-align: center");

有没有什么聪明的方法可以在最后添加这个关闭按钮,我只是错过了这个?

这个怎么样?

$(document).on("click",".ui-last-child",function(){
$(".ui-icon-delete").click();
})

这是 fiddle link.

试试这个,对我有用:

$(document).on("pagecreate", function() {
  $(".ui-btn-icon-notext.ui-icon-delete").removeClass("ui-btn-left");
  $(".ui-btn-icon-notext.ui-icon-delete").addClass("ui-btn-right");
});