Conflict between jQuery 1.5.1 and PhoneGap 1.4.1?

50 views
Skip to first unread message

nobby_...@yahoo.com

unread,
Feb 7, 2012, 9:28:41 AM2/7/12
to phonegap
Dear Forum,

I seem to be experiencing a conflict between jQuery 1.5.1 and PhoneGap
1.4.1 where I receive the message "'$' is undefined" when using the
jQuery namespace. I did find this post https://github.com/jquery/jquery-mobile/issues/442
which suggested rolling jQuery back to 1.4.3 and this does indeed seem
to work. Could a breaking change have been introduced to jQuery at
some point after that version?

Sticking with an old version of jQuery is not really an option for us
as I'm sure you can appreciate.

Thanks for your help in advance

Dan

The below example demonstrates - if the highlighted line is included,
the reference to $(document).ready fails with "'$' is undefined" when
using jQuery 1.5.1 but not with 1.4.3. Has anyone else experienced
anything like this?


<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>jQuery demo</title>

<script type="text/javascript" charset="utf-8" src="scripts/jquery/
jquery.js"></script>
<!-- *** FOLLOWING REFERENCE TO PHONE GAP BREAKS JQUERY WITH
JQUERY 1.5.1-->
<script type="text/javascript" charset="utf-8" src="scripts/
phonegap/phonegap.js"></script>

<script type="text/javascript">
$(document).ready(function () {
console.log('*** doc ready ***');
});
</script>
</head>
<body>

</body>
</html>

Libby

unread,
Feb 7, 2012, 1:54:07 PM2/7/12
to phon...@googlegroups.com
Why not use jquery 1.6.4?

nobby_...@yahoo.com

unread,
Feb 8, 2012, 7:45:18 AM2/8/12
to phonegap
Firstly, thanks for replying. Secondly, I'm stupid. I hadn't actually
even thought of trying the latest version, I had simply assumed I was
on the latest. I downloaded 1.7.1 and the error I was getting goes
away although I do still get an error later on but I can look into
this.

Thanks for your help

Dan

On Feb 7, 6:54 pm, Libby <libby.bald...@gmail.com> wrote:
> Why not use jquery 1.6.4?

Libby

unread,
Feb 8, 2012, 11:21:59 AM2/8/12
to phon...@googlegroups.com
You're welcome. And.. just thought I'd mention even though you're
not using jQuery Mobile.. which is only supported by jquery 1.6.4.
(not latest jquery)

If you're not using jQuery Mobile, not sure what issues if any you
might find on a mobile device.

Libby
Reply all
Reply to author
Forward
0 new messages