activeBtn is not defined #3723

inspektor99 opened this Issue Mar 2, 2012 · 12 comments


None yet

8 participants


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 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"); ...


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


I've exactly the same problem using the exact code from here

Tested in a Samsung Galaxy S2 with Android 2.3.4.

lmigdal commented Mar 4, 2012

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

romanbsd commented Mar 4, 2012

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

function fakeFixLoader(){
                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 = [];


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.



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.

audreyr commented Mar 6, 2012

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 with jquery-1.7.1.min.js (and phonegap-1.4.1.js).

@johnbender johnbender added a commit that closed this issue Mar 7, 2012
@johnbender johnbender Fixes #3723 43f2d61
@johnbender johnbender closed this in 43f2d61 Mar 7, 2012


Give the latest a whirl by using as your jquery mobile include and let me know if this fixes the issue.

lmigdal commented Mar 10, 2012

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 :)

sub commented Mar 22, 2012

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


Confirming the fix. Thanks!


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