Skip to content
This repository

activeBtn is not defined #3723

Closed
inspektor99 opened this Issue March 02, 2012 · 12 comments

8 participants

inspektor99 John Bender rogerjose81 lmigdal Roman Shterenzon Audrey Roy Davide Saurino Jhon Jaiver López
inspektor99

I get this error when I simply try to load a page in a web view on my Android application. I am using a Samsung Galaxy Player 5.0 running Android version 2.3.5.

I removed all custom JavaScript and HTML elements except for the main div with data-role="page" and I still see the problem.

This error is intermittent and happens about 50% of the time (it seems). Also this always happens if I change my app's orientation, forcing a re-load.

I am using jquery.mobile-1.1.0-rc.1.js with jquery-1.7.1.min.js

The error occurs on line 7269. I am able to fix (no idea if this is a correct fix) by declaring activeBtn = null; above line 7292.


var activeBtn = null; //TEMP FIX so i can reliably run my app
$.extend($.mobile, {
// turn on/off page loading message.
showPageLoadingMsg: function (theme, msgText, textonly) {
$html.addClass("ui-loading");
...

John Bender

@inspektor99

If you can post a sample of the page in the form of a jsbin or jsfiddle that would be extremely helpful. Thanks!

rogerjose81

I've exactly the same problem using the exact code from here http://jquerymobile.com/demos/1.1.0-rc.1/docs/pages/multipage-template.html.

Tested in a Samsung Galaxy S2 with Android 2.3.4.

lmigdal

The same here - Samsung Galaxy S2, Android 2.3.4. No problem in 1.0.1.

Roman Shterenzon

Same here. Fails in line 7271 (activeBtn.length):

function fakeFixLoader(){
        $loader
            .css({
                top: $.support.scrollTop && $window.scrollTop() + $window.height() / 2 ||
                activeBtn.length && activeBtn.offset().top || 100
Uncaught ReferenceError: activeBtn is not defined
            });     
    }

Temporary workaround for me was to declare a global var activeBtn = [];

rogerjose81

IMHO, the following is a better temporary workaround (checking if the global variable "activeBtn" was defined before referencing it or its properties). Please note I just added "window.activeBtn && " to the beginning of the line 7271.

window.activeBtn && activeBtn.length && activeBtn.offset().top ...

In that way you'll not overwrite the variable in the cases it came already initialized.

John Bender

@scottjehl

This looks like fallout from cde86da. Passing the activeBtn around to the helper function bindings is going to take a bit of work so I thought it would be best if you could take a look.

Audrey Roy

Just letting you know that I'm running into this too, on an HTC MyTouch 3G running Android 2.2.1. I'm also using jquery.mobile-1.1.0-rc.1.min.js with jquery-1.7.1.min.js (and phonegap-1.4.1.js).

John Bender johnbender closed this issue from a commit March 07, 2012
John Bender Fixes #3723 43f2d61
John Bender johnbender closed this in 43f2d61 March 07, 2012
John Bender

All,

Give the latest a whirl by using http://code.jquery.com/mobile/latest/jquery.mobile.js as your jquery mobile include and let me know if this fixes the issue.

lmigdal

I tested the app few times and the error is not showing up, thanks :) Still I've noticed that with this version the fixed footer doesn't work :)

Davide Saurino
sub commented March 22, 2012

Hi John, I had the same problem and latest jquerymobile solved it.
Thanks! :-)

inspektor99

Confirming the fix. Thanks!

Jhon Jaiver López

Another confirmation of the fix: Samsung Galaxy Tab 10.1 - Android 3.1
Upgraded from 1.1.0-rc.1 to lastest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.