jquery mobile autocomplete different behavior at loading page

我们两清 提交于 2019-12-02 10:18:10

You import the autocomplete script in the head tag. As JQM only loads this once (the first page you open) and then dynamically loads the div from the page you want to go to with data-role="page", the head tag from the first page is always used in the pages you redirect to from that page.

For more information read this page: http://jquerymobile.com/test/docs/pages/page-scripting.html (Scripts & styles in the head)

So you need to add this line:

<script src="jqm.autoComplete-1.4.3-min.js"></script>

to you page div, like this:

<div data-role="page" id="mainPage">
    <script src="jqm.autoComplete-1.4.3-min.js"></script>
    <div data-role="header">
    //rest of the code....
</div>//end of data-role="page"

This way the script will be loaded when JQM pulls in the page using AJAX and it will also be available when you go to the page directly

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