jquery 仅在phonegap 中工作index.html

标签 jquery cordova jquery-mobile phonegap-plugins cordova-plugins

问题是 Jquery 在 index.html 中正常工作。如果我单击注册按钮,打开 register.html 页面。但这里 Jquery 工作停止了。如果我从头上删除 Mobile Jquery Link 那么一切都会完美运行..

Index.html - index.html 工作完美。

<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> 
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="js/function.js"></script>
<script src="js/comman_phoneGap.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script> 

Register.html - :问题就在这里。我的脚本出了什么问题

<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>         
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="js/function.js"></script>
<script src="js/comman_phoneGap.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script> 

<form action="" method="post">   
     <div class="ui-field-contain">
          <label for="name">Full Name:</label>
           <input type="text" class="form-control" id="username" placeholder="Name">    
     </div>
     <div class="ui-field-contain">
           <label for="name">Full Name:</label>
           <input type="text" class="form-control"  id="email"  placeholder="email">
     </div>
     <div class="ui-field-contain">
            <label for="name">Full Name:</label>
            <input type="password" class="form-control" id="password"  placeholder="Password" />
      </div>           

      <div class="ui-field-contain">
            <label for="name">Full Name:</label>
            <input type="password" class="form-control" id="cpassword" placeholder="Password">
      </div>  
      <fieldset data-role="controlgroup" data-type="horizontal">
            <legend>Select Type</legend>
            <input type="radio" class="user_type" id="seller" value="seller">
            <label for="seller">Seller</label>
            <input type="radio" class="user_type" id="buyer" value="buyer">
            <label for="buyer">Buyer</label> 
      </fieldset>

      <button type="submit" onclick="return clicked();"  class="btn btn-block btn-success">Register</button> 
 </form>
 <script>
      function clicked()
       {
           alert('hello'); return false;
       }
 </script> 

clicked() function not working here. I am not understand. What is do.

最佳答案

这是临时解决方案..但工作完美..

function redirect(page)
    {

       $.mobile.changePage(
        window.location.href=page,
        {
          allowSamePageTransition : true,
          transition              : 'none',
          showLoadMsg             : false,
          reloadPage              : true
         }
      );
    }

Page Reference is Here. Get proper information

关于jquery 仅在phonegap 中工作index.html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32069006/

相关文章:

jQuery UI Datepicker - 日期范围 - 突出显示之间的日期

javascript - 根据文本输入的值添加 <select> 选项

android - Cordova 插件 VS2015 元视口(viewport)用户可扩展=是不工作

jquery - 移动设备上的全日历多单元格选择?

jquery - Chrome 中的 AJAX 发送选项而不是 GET/POST/PUT/DELETE?

node.js - 您无权查看 Azure Ionic App 的此目录或页面

cordova - 如何在 CLI 生成的 phonegap 应用程序中使用插件插件

javascript - 在 jQuery Mobile 中动态添加可折叠集和嵌套列表

jQuery Mobile 无法读取触发器 'options' 上未定义的 ('pagecreate' )

javascript - 使用对象和 jQuery 创建多个 html 元素