首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jquery移动初学者

问Jquery移动初学者
EN

Stack Overflow用户
提问于 2020-01-17 01:12:30
回答 1查看 31关注 0票数 1

我有一个小的网络应用程序,我想转换为使用jquery移动。但是,尽管我认为我有所有的初学者文档,但我有一些问题下面的页面仍然显示“本机”选择下拉框,据我所知,任何人可以快速发现问题。

代码语言:javascript
复制
<!doctype html>
<html>
<head>
    <title>My Page</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://code.jquery.com/mobile/[version]/jquery.mobile-1.4.5.min.css">
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page">

    <div data-role="header">
        <h1>My Title</h1>
    </div><!-- /header -->

    <div role="main" class="ui-content">
        <p>Hello world</p>
        <div class="ui-field-contain">
            <label for="select-custom-1">Basic:</label>
            <select name="select-custom-1" id="select-custom-1" data-native-menu="false">
                <option value="1">The 1st Option</option>
                <option value="2">The 2nd Option</option>
                <option value="3">The 3rd Option</option>
                <option value="4">The 4th Option</option>
            </select>
        </div>
    </div>
    <div data-role="footer">
        <h4>My Footer</h4>
    </div><!-- /footer -->
</div><!-- /page -->
</body>
</html>
EN

回答 1

Stack Overflow用户

发布于 2020-01-17 01:29:52

这里有两个问题。首先,URL中的[version]应该是您正在使用的jQuery移动实例的实际版本字符串;在本例中为1.4.5。

其次,移动端3.x不支持jQuery jQuery。您需要使用较旧的版本,例如1.12.1:

​

代码语言:javascript
复制
<!doctype HTML>
<html>
<head>
  <title>My Page</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
  <script src="https://code.jquery.com/jquery-1.12.1.min.js"></script>
  <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
  <div data-role="page">
    <div data-role="header">
      <h1>My Title</h1>
    </div>
    <div role="main" class="ui-content">
      <p>Hello world</p>
      <div class="ui-field-contain">
        <label for="select-custom-1">Basic:</label>
        <select name="select-custom-1" id="select-custom-1" data-native-menu="false">
          <option value="1">The 1st Option</option>
          <option value="2">The 2nd Option</option>
          <option value="3">The 3rd Option</option>
          <option value="4">The 4th Option</option>
        </select>
      </div>
    </div>
    <div data-role="footer">
      <h4>My Footer</h4>
    </div>
  </div>
</body>
</html>

​

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59774708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档