【问题标题】:jquery working only index.html in phonegapjquery 仅在 phonegap 中工作 index.html
【发布时间】:2015-08-18 09:48:08
【问题描述】:

问题是 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() 函数在这里不起作用。我不明白。是做什么的。

【问题讨论】:

  • 检查你是否在页面加载时初始化cordova.js
  • cordova.js 正确初始化

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


【解决方案1】:

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

function redirect(page)
    {

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

Page Reference is Here. Get proper information

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-10
    • 2011-11-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多