Reputation: 195
I'm referencing the following jquery files in my header:
<link rel='stylesheet' href='$root/css/jquery.mobile-1.3.2.min.css'>
<script type='text/javascript' src='$root/js/jquery.mobile-1.3.2.min.js'>
</script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'>
</script>
I get the following error:
a is undefined
The error references the entire jquery.mobile-1.3.2.min.js file.
Any ideas why this is happening?
Upvotes: 2
Views: 4249
Reputation: 56509
The order of the script are wrong. Also close the link
tag.
jQuery mobile is called after jQuery.
Here is the CDN-hosted files
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
From your point of view:
<link rel='stylesheet' href='$root/css/jquery.mobile-1.3.2.min.css'/>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'>
</script>
<script type='text/javascript' src='$root/js/jquery.mobile-1.3.2.min.js'>
</script>
Upvotes: 4
Reputation: 13533
You have to include JQuery
first and then JQuery Mobile
. This is because JQuery Mobile
is using JQuery
and when you include JQuery Mobile
first it will look for JQuery
funcitons, which won't be included at this stage.
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.js"></script>
Upvotes: 3