Search code examples
jquerycordovajquery-mobilephonegap-pluginscordova-plugins

jquery working only index.html in phonegap


The problem is Jquery working proper in index.html . If i click on register button open register.html page. But here Jquery working stop. If I removed Mobile Jquery Link from head then everything is working perfect..

Index.html - index.html working perfect.

<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 - : Problem is here. What wrong with my script

<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.


Solution

  • This is Temporary solution.. But work perfectly ..

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

    Page Reference is Here. Get proper information