jQuery $.mobile library is undefined - javascript

I have linked jQuery and jQuery mobile to my code. I got this error in the console:
TypeError: $.mobile is undefined
I have rechecked the URL and all are correct, I have update the files(jQuery, jQuery mobile) and the issue is still exists.
I have place the jquery.js before jquery.mobile.js
This is my code:
<script src="JS/jquery.js" type="text/javascript"></script>
<script src="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>
<script src="JS/bootstrap.min.js" type="text/javascript"></script>
<script src="JS/code.js" type="text/javascript"></script>
and it's on the end of the file.
the content of code.js: http://pastebin.com/3LTcxs9S

<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js">
</script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-
1.3.1.min.js"></script>
try this by replacing your code
NOTE* put jquery mobile script at last after putting all jquery library scripts, im sure it will work

Related

Uncaught ReferenceError: $ is not defined Bootsrap Notify

I've just include the notify Plugin for bootstrap into my page. When I call
echo '<script>$( document ).ready(function() {$.notify("Hello World");});</script>';
the console told me this:
Uncaught ReferenceError: $ is not defined
Here are my Javascript includes.
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/bootstrap-notify.min.js"></script>
<script src="assets/js/select2.min.js"></script>
<script src="assets/js/contact.js"></script>
<script src="assets/js/smoothscroll.js"></script>
<script src="assets/js/counter.js"></script>
<script src="assets/js/page.js"></script>
<script src="assets/js/responsive-menu.js"></script>
Keep your jquery and boostrap js links in the top portion of your head tag and test it again .The problem must be resolved.
This is generally occurs because your doc ready function is loading prior than jquery.js.
<html>
<header>
jquery.js and bootstrap.js at top here
</header>
<body>
</body>
all the remaining links
<script>
document ready here
</script>
<html>

conflict beetween mootols and ajax script

I am not expert programmer and I need an help.
I have a conflict between these codes:
<script type="text/javascript" src="mootools-1.5.1-core.js"></script>
<script src="src/tooltip.js" type="text/javascript"></script>
the tooltip.js code is in this package:
http://www.menucool.com/download/tooltip.zip
In the project I will need use the jquery also.
Thank you in advance for your help.
A.
If using jQuery and mooTools is a must, you can run jQuery in noConflict mode. The order of the scripts should look like this to work:
<script src"path/to/jquery.js" type="text/javascript"></script>
<script src="src/tooltip.js" type="text/javascript"></script>
<!-- this will make jQuery available through the jQuery variable -->
<script type="text/javascript">$.noConflict();</script>
<script type="text/javascript" src="mootools-1.5.1-core.js"></script>

Uncaught TypeError: undefined is not a function

I have checked a lot of forums, but i did't find a solution.
site -> http://dszerszen.pl/domi/
and this code
<script type="text/javascript">
$(document).ready(function(){
$(".info").tytabs({
tabinit:"1",
fadespeed:"fast"
});
});
</script>
icon switcher dosent work
Simply rearrange your scripts in this order:
<script type="text/javascript" src="jquery.min.js"></script>
<script src="modernizr.custom.63321.js"></script>
<script type="text/javascript" src="tytabs.jquery.min.js"></script>
<script src="scrolltop.js" type="text/javascript"></script>
<script async src="analytics.js"></script>
The jQuery core library should be included first followed by the other plugin code.
You have defined scrollTop.js in two places.
One is at the top of css files. And jquery is not loaded before that. That's why you are getting error.
<title>Smykke Galleriet</title>
<link type="text/css" rel="stylesheet" href="stylesheet.1.css" />
<script src="scrolltop.js" type="text/javascript"></script>
Remove that line and it will work properly.

jQuery Mobile + Cordova random errors on startup, stuck on a grey circle in the middle

I have a jQuery Mobila app wrapped with Cordova that I test on my Android device. It is fine when I launch it normally, but when I use a web intent (https://github.com/Initsogar/cordova-webintent) to launch it, the console debug shows random errors coming from the jQuery Mobile js file:
D/CordovaLog(24140): file:///android_asset/www/jquery/jquery.mobile-1.4.0.min.js: Line 7661 : Uncaught TypeError: Object # has no method 'addClass'
D/CordovaLog(22727): file:///android_asset/www/jquery/jquery.mobile-1.4.0.min.js: Line 10116 : Uncaught TypeError: Object # has no method 'each'
I am aware that these bugs are properly caused by the code I am trying to render on startup, and I'm guessing that the js files I include in the tags in index.html might be in the wrong order. Here is my current setup:
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script src="jquery/jquery-1.9.1.min.js"></script>
<script src="jquery/jquery-ui.min.js"></script>
<script src="jquery/jquery.ui.touch-punch.min.js"></script>
<script src="jquery/jquery.mjs.nestedSortable.js"></script>
<script src="js/json2.js"></script>
<script src="js/jstorage.js"></script>
<script src="jquery/jquery.mobile-1.4.0.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript">
app.initialize();
</script>
I have also tried putting jquery.mobile-1.4.0.min.js under jquery-1.9.1.min.js, but similar things have happened.
Afterwards, I re-ordered them into this:
<script src="jquery/jquery-1.9.1.min.js"></script>
<script src="jquery/jquery.mobile-1.4.0.min.js"></script>
<script src="jquery/jquery-ui.min.js"></script>
<script src="jquery/jquery.ui.touch-punch.min.js"></script>
<script src="jquery/jquery.mjs.nestedSortable.js"></script>
<script src="js/json2.js"></script>
<script src="js/jstorage.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
<script type="text/javascript" src="js/app.js"></script>
And it seemed to work fine for a while or so, but am still seeing jQuery Mobile bugs here and there.

jalert not working

I have following script:
<script type="text/javascript" src="jquery-1.8.2.js"></script>
<script type="text/javascript">
jAlert("message","title");
</script>
in my html head.but the dialog is not showing up when I load the page(it would if I simply use alert).
where did I do wrong? Am I missing the corresponding js files?
edit: I included the jquery.alerts.js file.it is still not working.
edit: I added this line and put the file in the dir
<script type="text/javascript" src="jquery.alerts.js"></script>
Yes I put it inbetween.
I opened the browser console and saw this:
"Uncaught TypeError: Cannot read property 'scrollHeight' of null jquery-1.8.2.js:9405"
jAlert isn't a part of native jQuery.
You can find the project page here, the download link is at the bottom.
Make sure you include it straight after jQuery - your code should look as follows:
<link rel="stylesheet" type="text/css" href="jquery.alerts.css" />
<script type="text/javascript" src="jquery-1.8.2.js"></script>
<script type="text/javascript" src="jquery.alerts.js"></script>
<script type="text/javascript">
$(document).ready(function(){
jAlert("message","title")
});
</script>

Categories