Quantcast
Channel: jQuery Forum
Viewing all 12211 articles
Browse latest View live

Uncaught Error: cannot call methods on page prior to initialization;

$
0
0
I'm getting this error in the console:
Uncaught Error: cannot call methods on page prior to initialization; attempted to call method 'bindRemove'

It happens when I try to activate a panel widget.
here is the markup (it has <?php ?> becouse it's part of a wordpress theme I'm working on)

  1. <!-- /panel -->
  2. <div data-role="panel" id="menu-panel">
  3.     <?php  wp_nav_menu ($args); ?> 
  4. </div>
  5. <!-- /panel open btn -->
  6.  <header data-role="header">
  7.     <a href="menu-panel">open</a>
  8.  </header>
the page is http://ugauga.com/

Thanks



success or done for JQuery Mobile Ajax

$
0
0
Hi,

I want to ask what do you prefer to use when you send ajax form in JQuery Mobile? (success-error) or (done-fail)?


Thanks,

Re : Uncaught Error: cannot call methods on page prior to initialization;

$
0
0
You forgot the hash # in href

  1. <a href="#menu-panel">open</a>

Re : success or done for JQuery Mobile Ajax

$
0
0
Success-error is older. If you use it, it says you have been doing this for a long time. (more than 2 years)

If you use done-fail, it shows you have been reading new code and have switched or always have written it that way,

They work the same. It just says a little bit about you when you use one or the other. 

I use both, but I do not mix them on one site!!!!!

JΛ̊KE

$.mobile.navigate(...) vs (":mobile-pagecontainer").pagecontainer("change", ...)

$
0
0
Hello. I've noticed there are 2 jqm-friendly ways to change between pages, what is the difference between them and which one should I use?

Re : $.mobile.navigate(...) vs (":mobile-pagecontainer").pagecontainer("change", ...)

What's the best way to transmit a variable from one page to another?

$
0
0
Hello,
Could someone tell me the best way to transmit one variable from one page to another?
can we do it by:
$.mobile.changePage($("#P_Aliments"), {data: "id", value: "value"});
or by href="#link?id='value'"
or ...
and how can I retrieve this value the other side?

Thans for your help




Re : What's the best way to transmit a variable from one page to another?


Re : $.mobile.navigate(...) vs (":mobile-pagecontainer").pagecontainer("change", ...)

$
0
0
Use $.mobile.pageContainer.pagecontainer() not $.mobile.navigate()

In addition to what @jake has mentioned, pagecontainer accepts arguments/options (e.g. transitions, reverse, etc..) while navigate doesn't


$.Mobile.chanePage showing white screen in iphone 6 ( IOS 9)

$
0
0
I am using Jquery mobile 1.2. when executing the below code, white screen is appearing on the screen. Particularly in large screen. If i apply the property transition : "none", it is working fine. But i don't want to loose the transition. Can someone please help on this.

function _ReturnToHome() {
  $.mobile.changePage("#Home", { reverse: "true" });
    if(_isIOSSafari()) {        
        setTimeout(function() { _setCompletionStatus(); }, 500);              
    }
    else
        _setCompletionStatus(); 

Re : $.Mobile.chanePage showing white screen in iphone 6 ( IOS 9)

$
0
0
jQuery mobile 1.2 is not compatible with IOS 9. It is only barely compatible with browsers released before it was.

Try 1.4.5

JΛ̊KE

Re : Uncaught Error: cannot call methods on page prior to initialization;

$
0
0
Thanks Man!

I don't know I could have overlooked this!


After pressing the button will display the confirm page again and again,how to fix it?

$
0
0
<!DOCTYPE html>
<html>
<head>
    <title>jQM</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script>
$(document).on('pagecontainershow', function (e, ui) {
var activePage = $(':mobile-pagecontainer').pagecontainer('getActivePage');
if(activePage.attr('id') === 'login') {
        $(document).on('click', '#submit', function() {
            if($('#username').val().length > 0 && $('#password').val().length > 0){   
            } else {
$.mobile.changePage( "#errtip", { role: "dialog" } );
            }          
            return false;
        });  
    }
});
 </script>
</head>
<body>
    <div data-role="page" id="login" data-theme="b">
        <div data-role="header" data-theme="a">       
            <h3>login</h3>
        </div>
        <div data-role="content">
            <form id="check-user" class="ui-body ui-body-a ui-corner-all" data-ajax="false">
                <fieldset>
                    <div data-role="fieldcontain">
                        <label for="username">Enter your username:</label>
                        <input type="text" value="" name="username" id="username"/>
                    </div>                                 
                    <div data-role="fieldcontain">                                     
                        <label for="password">Enter your password:</label>
                        <input type="password" value="" name="password" id="password"/>
                    </div>
                    <input type="button" data-theme="b" name="submit" id="submit" value="Submit">
                </fieldset>
            </form>                             
        </div>
        <div data-theme="a" data-role="footer" data-position="fixed">
        </div>
    </div>
    <div data-role="page" id="second">
        <div data-theme="a" data-role="header">
            <a href="#login" class="ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-left ui-icon-delete" id="back-btn">返迴</a>      
            <h3>welcome</h3>
        </div>
        <div data-role="content"> 
        </div>
        <div data-theme="a" data-role="footer" data-position="fixed">
            <h3>footer</h3>
        </div>
    </div>
<div data-role="page" id="errtip">
        <div data-theme="a" data-role="header">
            <a href="#" onclick="$('.ui-dialog').dialog('close')" data-role="button" data-theme="c">close</a>      
            <h3>welcome</h3>
        </div>
        <div data-role="content"> 
        </div>
        <div data-theme="a" data-role="footer" data-position="fixed">
            <h3>footer</h3>
        </div>
    </div>
</body>
</html>

Re : What's the best way to transmit a variable from one page to another?

Re : After pressing the button will display the confirm page again and again,how to fix it?

$
0
0
Don't wrap event listeners with pagecontainershow event. Just move it outside that event.

Listen to submit event if it's a form.

jQuery mobile navbar items not clickable on page loaded through $( ":mobile-pagecontainer" ).pagecontainer()

$
0
0
I have created a simple index.html file in which there is only one button. On clicking the button $( ":mobile-pagecontainer" ).pagecontainer("change", "page2.html"); is called to navigate to page2. 
After moving to page2, a navbar is present within it but the navbar items are not clickable.
Below are the codes:

index.html
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="UTF-8">
  5.         <link rel="stylesheet" type="text/css" href="jqm/jquery.mobile-min.css">
  6.         <title>Blank App Designer Cordova Web App Project Template</title>
  7.         <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  8.         <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=no">
  9.         <style>
  10.                 @-ms-viewport { width: 100vw ; min-zoom: 100% ; zoom: 100% ; }          @viewport { width: 100vw ; min-zoom: 100% zoom: 100% ; }
  11.                 @-ms-viewport { user-zoom: fixed ; min-zoom: 100% ; }                   @viewport { user-zoom: fixed ; min-zoom: 100% ; }
  12.         </style>
  13.         <link rel="stylesheet" href="css/app.css">
  14.         <link rel="stylesheet" type="text/css" href="css/index_main.less.css" class="main-less">
  15.         <script src="cordova.js" id="xdkJScordova_"></script>
  16.         <script src="js/app.js"></script>
  17.         <script src="js/init-app.js"></script>
  18.         <script src="xdk/init-dev.js"></script>      
  19.         <script type="application/javascript" src="lib/jquery.min.js"></script>
  20.         <script type="application/javascript" src="jqm/jquery.mobile-min.js" data-ver="0"></script>
  21.     </head>

  22.     <body onload="init()">
  23.         <div class="upage vertical-col left" id="mainpage" data-role="page" data-theme="b"><a class="widget uib_w_1 d-margins" data-uib="jquery_mobile/button" data-ver="0" data-role="button" id="clickButton">Click</a>
  24.         </div>
  25.     </body>

  26. </html>
page2.html
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Mister Math - Ask me math!</title>
  5.     <meta name="viewport" content="width=device-width, initial-scale=1">
  6.     <link rel="stylesheet" type="text/css" href="jqm/jquery.mobile-min.css">
  7.     <link rel="stylesheet" href="css/app.css">
  8.     <link rel="stylesheet" type="text/css" href="css/index_main.less.css" class="main-less">
  9.     <script src="cordova.js" id="xdkJScordova_"></script>
  10.     <script src="js/app.js"></script>  
  11.     <script src="js/init-app.js"></script>      
  12.     <script src="xdk/init-dev.js"></script>    
  13.     <script type="application/javascript" src="lib/jquery.min.js"></script>
  14.     <script type="application/javascript" src="jqm/jquery.mobile-min.js" data-ver="0"></script>
  15. </head>

  16. <body onload="init()">
  17. <div data-role="page" id="pageone" data-theme="b">
  18.   <div data-role="header">
  19.     <h1>Header</h1>
  20.     <div data-role="navbar">
  21.       <ul>
  22.         <li><a href="#" class="ui-btn-active" data-icon="home">Home</a>
  23.         </li>
  24.         <li><a href="#pagetwo" data-icon="arrow-r">Page Two</a>
  25.         </li>
  26.       </ul>
  27.     </div>
  28.   </div>

  29.   <div data-role="main" class="ui-content">
  30.     <p>This is page 1</p>
  31.   </div>

  32.   <div data-role="footer">
  33.     <h1>Footer</h1>
  34.   </div>
  35. </div>

  36. <div data-role="page" id="pagetwo" data-theme="b">
  37.   <div data-role="header">
  38.     <h1>Header</h1>
  39.     <div data-role="navbar">
  40.       <ul>
  41.         <li><a href="#pageone" data-icon="home">Home</a>
  42.         </li>
  43.         <li><a href="#" data-icon="arrow-r">Page Two</a>
  44.         </li>
  45.       </ul>
  46.     </div>
  47.   </div>

  48.   <div data-role="main" class="ui-content">
  49.     <p>This is page 2</p>
  50.   </div>

  51.   <div data-role="footer">
  52.     <h1>Footer</h1>
  53.   </div>
  54. </div>
  55. </body>
  56. </html>
app.js
  1. function init() { 
  2.     document.addEventListener("deviceready", deviceReady, true);
  3. }

  4. function deviceReady(){
  5. $(document).on('click','#clickButton', function(e) {
  6. $( ":mobile-pagecontainer" ).pagecontainer("change", "page2.html");
  7. });
  8. }

The navbar links are clickable if I directly view page2.html in any web browser but it is not clickable when it is loaded inside the app using 
$( ":mobile-pagecontainer" ).pagecontainer("change", "page2.html");

Can anyone help me out fixing this?
Thanks in advance

Re : jQuery mobile navbar items not clickable on page loaded through $( ":mobile-pagecontainer" ).pagecontainer()

$
0
0
Your second document has two pages in it. That won't work, because when jQuery Mobile uses Ajax to load a document, it only load the FIRST page found in the document.

Either:

- put ALL of your pages in ONE document (which I do not recommend)

- put each page in a separate document

Also, you should not use $(document).ready(), .load(), etc. in JQM projects. Use JQM page or pagecontainer events.

Re : jQuery mobile navbar items not clickable on page loaded through $( ":mobile-pagecontainer" ).pagecontainer()

$
0
0
Thanks a lot for your answer. It works.

Re : After pressing the button will display the confirm page again and again,how to fix it?

Re : After pressing the button will display the confirm page again and again,how to fix it?

Viewing all 12211 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>