jQM select pre-render?

末鹿安然 提交于 2021-02-11 18:22:03

问题


I am using a grouped select to achive my desired interface...two questions:

  1. I need to intercept the DOM before actually showing the list of selects because there is text in the injected SPAN that jQM adds which I want to further enhance by wrapping some minor text in tags for better visual acuity.

  2. The select controls will not seem to go full width given this code.

    <fieldset data-role="controlgroup" data-mini="true">
    

Any ideas on how I might accomplish these tasks in 1.4???

Regards, Alex


回答1:


You can tell jQuery Mobile to not auto-initialize any widget with a specific tag name, id or a class.

Place the code below in head, after jQuery.js and before jQuery Mobile.

<head>
  <!-- jQuery.js -->
  <script>
    $(document).on("mobileinit", function () {
      $.mobile.keepNative = ".native"; /* jQM 1.4 */
    });
  </script>
  <!-- jQM.js -->
</head>

Now, add class native to select, to stop JQM from enhancing it on startup.

Do whatever changes you want and then enhance it manually.

$("select").removeClass("native").selectmenu();

Demo



来源:https://stackoverflow.com/questions/20851624/jqm-select-pre-render

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