Uncaught ReferenceError: $ is not defined?
How come this code throws an
Uncaught ReferenceError: $ is not defined
when it was OK before?
$(document).ready(function() {
$('#tabs > ul').tabs({ fx: { opacity: 'toggle' } });
$('#featuredvid > ul').tabs();
});
Results in tabs don't close anymore.
jQuery is referenced in the header:
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/sprinkle.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-ui-personalized-1.5.2.packed.js"></script>
javascript jquery referenceerror
add a comment |
How come this code throws an
Uncaught ReferenceError: $ is not defined
when it was OK before?
$(document).ready(function() {
$('#tabs > ul').tabs({ fx: { opacity: 'toggle' } });
$('#featuredvid > ul').tabs();
});
Results in tabs don't close anymore.
jQuery is referenced in the header:
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/sprinkle.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-ui-personalized-1.5.2.packed.js"></script>
javascript jquery referenceerror
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script> Take this on top
– captainsac
Jun 10 '15 at 7:44
Maybe sometime calling the ready function before the JQuery loads then this error may occurs
– Sagar Naliyapara
Apr 25 '17 at 11:44
add a comment |
How come this code throws an
Uncaught ReferenceError: $ is not defined
when it was OK before?
$(document).ready(function() {
$('#tabs > ul').tabs({ fx: { opacity: 'toggle' } });
$('#featuredvid > ul').tabs();
});
Results in tabs don't close anymore.
jQuery is referenced in the header:
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/sprinkle.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-ui-personalized-1.5.2.packed.js"></script>
javascript jquery referenceerror
How come this code throws an
Uncaught ReferenceError: $ is not defined
when it was OK before?
$(document).ready(function() {
$('#tabs > ul').tabs({ fx: { opacity: 'toggle' } });
$('#featuredvid > ul').tabs();
});
Results in tabs don't close anymore.
jQuery is referenced in the header:
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/sprinkle.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-ui-personalized-1.5.2.packed.js"></script>
javascript jquery referenceerror
javascript jquery referenceerror
edited Sep 4 '17 at 19:48
Soviut
57.9k33144208
57.9k33144208
asked Jan 15 '10 at 23:04
OliversOlivers
2,8093136
2,8093136
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script> Take this on top
– captainsac
Jun 10 '15 at 7:44
Maybe sometime calling the ready function before the JQuery loads then this error may occurs
– Sagar Naliyapara
Apr 25 '17 at 11:44
add a comment |
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script> Take this on top
– captainsac
Jun 10 '15 at 7:44
Maybe sometime calling the ready function before the JQuery loads then this error may occurs
– Sagar Naliyapara
Apr 25 '17 at 11:44
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script> Take this on top
– captainsac
Jun 10 '15 at 7:44
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script> Take this on top
– captainsac
Jun 10 '15 at 7:44
Maybe sometime calling the ready function before the JQuery loads then this error may occurs
– Sagar Naliyapara
Apr 25 '17 at 11:44
Maybe sometime calling the ready function before the JQuery loads then this error may occurs
– Sagar Naliyapara
Apr 25 '17 at 11:44
add a comment |
36 Answers
36
active
oldest
votes
1 2
next
You should put the references to the jquery scripts first.
<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/sprinkle.js"></script>
22
Just to be sure this is clear: you cannot put the script reference to jquery-ui before the jquery script itself. That's what fixed the problem to me: first jquery-x.x.x.min.js, then jquery-ui-xxxxxx.js.
– wdanda
Nov 19 '10 at 1:05
21
2 years later, still the answer is not "ticked" ) This articles describes this one and 4 more common cases when this error occurs.
– Uzbekjon
Feb 14 '13 at 9:46
2
@Uzbekjon That solved it for me. The path to the script was wrong in one of myHTML
files.
– Adam Jensen
Oct 22 '14 at 5:46
@Jeremy, thanks a lot. Also put it before any partial view(mvc) so that it is available for any script in the partial.
– Andrew Day
Dec 9 '16 at 17:17
this solution is not working
– always-a-learner
Jul 9 '17 at 4:06
|
show 1 more comment
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
10
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
– Ram Sharma
Aug 21 '15 at 12:33
22
@RamSharma Actually, this is the right answer. You don't need anything else to solve the issue.
– Derek 朕會功夫
Nov 20 '15 at 20:21
Thanks a lot !!! worked for me.
– this is yash
Nov 22 '18 at 17:14
Yup. This was my problem. Simply had jquery AFTER referencing my js file. D'oh!
– daneiswork
Feb 7 at 11:49
add a comment |
This is what solved it for me. Originally I went to Google and copied and pasted their suggested snippet for jQuery on their CDN page:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
The snippet does not include the HTTP:
or HTTPS:
in the src
attribute but my browser, FireFox, needed it so I changed it to:
edit: this worked for me with Google Chrome as well
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Then it worked.
12
Strictly speaking the Google snippet/example is correct - their src attribute is a protocol less URL which means the browser should use the protocol (HTTP/HTTPS) of the calling page. See paulirish.com/2010/the-protocol-relative-url. This is best practice to avoid mixed content warnings if your page is ever served over SSL and the scripts are not.
– pwdst
Aug 11 '13 at 19:04
12
One common problem here, likely, is when protocol-relative URL's are used during development, and on a sunny day you try to load a page from a local file. Your browser will optimistically try to loadfile://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
and you wonder why it doesn't show up in the network console.
– Pieter Ennes
Apr 1 '14 at 15:02
thanks @PieterEnnes, this was exactly the case for me. Thanks to the answerer too!
– jwg
Aug 19 '14 at 16:01
add a comment |
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur. So, always keep your own JavaScript or jQuery code after calling the jQuery plugin so the solution for this is :
First add the link to the jQuery file hosted at GoogleApis or a local jQuery file that you will download from http://jquery.com/download/ and host on your server:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
or any plugin for jQuery. Then put your custom script file link or code:
<script src="js/custom.js" type="text/javascript"></script>
3
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur
the perfect answer.. in my case script was in footer
– echoashu
Nov 23 '14 at 16:23
add a comment |
In my case I was putting my .js
file before the jQuery script link, putting the .js
file after jQuery script link solved my issue.
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="exponential.js"></script>
Just used this to fix my jschart.
– indofraiser
Feb 13 '17 at 13:12
add a comment |
Okay, my problem was different - it was Document Security model in Chrome.
Looking at the answers here, it was obvious that I was somehow not loading my jquery files before calling the $(document).ready()
etc. functions. However, they were all in the correct positions.
In my case, this was because I was accessing the content over a secure HTTPS connection, whereas the page was trying to download the CDN hosted data from google, etc. The solution was to store them locally and then include then directly rather than from the CDN each time.
Edit: The other way of doing this is to link to all the CDN-hosted stuff as https:// rather than http:// - then the model doesn't complain.
5
Also, note that you can leave the protocol off links and it will choose the appropriate one depending on the context (assuming both http and https versions exist). See stackoverflow.com/a/3622615/4332
– Adrian Mouat
Aug 13 '13 at 13:53
yep. this one solved my problem, I was loading the scripts from an Url like this ´//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js´. Using ´cdnjs...´ works great
– xyz
Jun 23 '17 at 23:53
add a comment |
Add the library before you start the script.You can add any of these following CDN to start it.
Google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Microsoft
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
Jquery
If you want any other Jquery cdn version check this link.
After this:
<script type="text/javascript">
$(function(){
//your stuff
});
or
$(document).ready(function(){
//your stuff
});
</script>
Wordpress:
<script type="text/javascript">
var $ = jQuery;
jQuery(document).ready(function($){
//your stuff
});
</script>
add a comment |
If it's in wordpress, might be needed to change
$(document).ready(function() {
to
jQuery(document).ready(function($){
or add
var $ = jQuery;
before
$(document).ready(function() {
add a comment |
In my case I had this referenceError as the order of script calls was wrong. Solved that by changing the order:
<script src="js/index.js"></script>
<script src="js/jquery-1.10.2.js"></script>
to
<script src="js/jquery-1.10.2.js"></script>
<script src="js/index.js"></script>
1
Mostly this was the problem I too found when a reference error happens for '$'
– Dipak
Jun 9 '14 at 7:08
add a comment |
I had the exact same problem and none of these solutions above helped.
however, I just linked the .css
files after the .js
files and the problem miraculously disappeared. Hope this helps.
10
First, for better page rendering performance you should always link CSS files before JS files. Second, the order of css and js files should have no effect in the current cituation.
– Uzbekjon
Feb 14 '13 at 9:43
5
"What fixed your problem shouldn't fix your problem and you shouldn't do what fixed your problem."
– Andrew
Oct 21 '15 at 16:32
add a comment |
I am proably the only person who had my kind of problem but ill put it down anyway. I wanted to try to make my script asynchronous just for the fun of it. Then i forgot about it and when i went live the [custom].js file only loaded 50% of the time before the jQuery.js.
So i changed
<script async src="js/script.js"></script>
to
<script src="js/script.js"></script>
:)
add a comment |
If you are doing this in .Net and have the script file referenced properly and you jQuery looks fine, make sure that your users have access to the script file. The project I was working on (a coworker) had their web.config denying access to anonymous users. The page I was working on was accessible to anonymous users therefore they didn't have access to the script file. Dropped the following into the web.config and all was right in the world:
<location path="Scripts">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
add a comment |
The source file jquery-1.2.6.min.js
is not called the jQuery command $()
is executed earlier than <..src='jquery-1.2.6.min.js'>
.
Please run <.. src="/js/jquery-1.2.6.min.js..">
at first and make sure the src path is right, then execute jquery command
$(document).ready(function()
add a comment |
This happened to me before.
The reason was that I'm connecting android to a webview with a JS. And I sent a parameter without quotes.
js.sayHello(hello);
and when I changed it to
js.sayHello('hello');
it worked.
I've no idea what parameter without quotes means... it sounds like you had a reference error.
– Aluan Haddad
Mar 18 '17 at 5:02
I had a problem in Freemarker and the reason was absence of single quotes, so the value was treated not like a string, but as a variable
– torina
Apr 9 '18 at 17:02
add a comment |
Your JavaScript file is missing so this error occurred. Just add the JavaScript file inside the <head>
tag. See the example:
<script src="js/sample.js" type="text/javascript"></script>
<link href="css/sample.css" rel="stylesheet" type="text/css" />
or add the following code in tag :
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
add a comment |
In my case it was a typo, I forgot a backslash and was referencing the source incorrectly.
Before src="/scripts/jquery.js"
After src="scripts/jquery.js"
add a comment |
The error will occur in the following two scenarios as well.
- @section scripts element is missing from the HTML file
- Error in accessing DOM elements. For example accessing of DOM element is mentioned as $("js-toggle") instead of $(".js-toggle"). Actually the period is missing
So 3 things to be followed - check required scripts are added, check if it is added in the required order and third syntax errors in your Java Script.
Yeah. and for id attributes $('#someDiv')
– CagCak
Apr 28 '17 at 22:36
Up Vote for your ASP.NET MVC @section scripts pointer
– Nattrass
Jun 23 '17 at 9:57
add a comment |
Doh! I had mixed quotes in my tags that caused the jquery reference to break. Doing an inspect in Chrome allowed me to see that the file wasn't properly linked.
add a comment |
In my case i forgot to include this :
<script src ="jquery-2.1.1.js"></script>
Earlier I was including just jquery-mobile which was causing this error.
add a comment |
Ok I admit this one was a really dumb thing that happend once to me. I modified the script tag to point to the right content and changed the script order to be the right one in the editor ... but totally forgot to save the change ;( You might laugh now but when you're tired all sort of strange problems might happen. I
add a comment |
I had a similar issue and it was because I was missing a closing > on a style sheet link.
add a comment |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="local_xxx.js"></script>
I have similar issue, and you know what, it's because of network is disconnected when I test in android device webview and I don't realize it, and the local js no problem to load because it doesn't need network. It seems ridiculous but it waste my ~1 hour to figure out it.
add a comment |
Strange enough, my problem was coming from PHP.
A REST API call was failing, and it was breaking the loading of the libraries afterwards. Since failure was from the REST call, it was not giving me a php compile error.
Keep this as an option also, if loading jquery seems ok.
add a comment |
I had this issue, when I was browsing internet through my mobile hotspot. it was also compressing images and added the following script at the bottom of body tag
<script language="javascript"><!--
bmi_SafeAddOnload(bmi_load,"bmi_orig_img");//-->
</script>
When I connected to proper wifi connection, all seems to work find for me. Hope this help someone.
add a comment |
I had similar issue. My test server was working fine with "http". However it failed in production which had SSL.
Thus in production, I added "HTPPS" instead of "HTTP" and in test, i kept as it is "HTTP".
Test:
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Production:
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Hope this will help someone who is working on wordpress.
add a comment |
This can also happen, if there is network issue. Which means, that even though the " jquery scripts " are in place, and are included prior to usage, since the jquery-scripts are not accessible, at the time of loading the page, hence the definitions to the "$" are treated as "undefined references".
FOR TEST/DEBUG PURPOSES :: You can try to access the "jquery-script" url on browser. If it is accessible, your page, should load properly, else it will show the said error (or other script relevant errors). Example - http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js should be accessible, on the browser (or browser context stances).
I had similar problem, in which I was able to load the html-page (using scripts) in my windows-host-browser, but was not able to load in vm-ubuntu. Solving the network issue, got the issue resolved.
add a comment |
var $ = jQuery;
jQuery(document).ready(function($){
1
This is absolutely not an answer. You have to add some explanations.
– jml
Apr 14 '17 at 12:07
This is a solution forWordpress
you should mention that.
– Hexodus
May 2 '17 at 17:23
You saved my day. Was struggling to do it in WordPress and none but this solution worked like a charm.
– rahimv
May 8 '17 at 14:19
add a comment |
I had the same problem , and I solved by putting jQuery at the top of all javascript codes I have in my code.
Something like this:
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="js/app.js" type="text/javascript"></script>
<script src="js/form.js" type="text/javascript"></script>
<script src="js/create.js" type="text/javascript"></script>
<script src="js/tween.js" type="text/javascript"></script>
Hope can help some one in future.
add a comment |
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
If you're in ASP.NET MVC, you can specify when your JS code should be rendered, by doing this:
1, In your page.cshtml
wrap your <script>
tag into a section, and give it a name, the common name to use is 'scripts':
@section scripts {
<script>
// JS code...
</script>
}
2, In your _Layout.cshtml
page add @RenderSection("Scripts", required: false)
, make sure to put it after you reference the Jquery source, this will make your JS code render later than the Jquery.
add a comment |
Root problem is a ReferenceError
. MDN indicates that a try
/catch
block is the proper tool for the job. In my case, I was getting uncaught reference error for a payment sdk/library. The below works for me.
try {
var stripe = Stripe('pk_test_---------');
} catch (e) {
stripe = null;
}
if(stripe){
//we are good to go now
}
Obviously the fix is to load whatever SDK/library, e.g. jQuery, prior to calling its methods but the try
/catch
does keep your shared JavaScript from barfing up errors in case you run that shared script on a page that doesn't load whatever library you use on a subset of pages.
add a comment |
1 2
next
protected by Community♦ Aug 21 '13 at 5:56
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
36 Answers
36
active
oldest
votes
36 Answers
36
active
oldest
votes
active
oldest
votes
active
oldest
votes
1 2
next
You should put the references to the jquery scripts first.
<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/sprinkle.js"></script>
22
Just to be sure this is clear: you cannot put the script reference to jquery-ui before the jquery script itself. That's what fixed the problem to me: first jquery-x.x.x.min.js, then jquery-ui-xxxxxx.js.
– wdanda
Nov 19 '10 at 1:05
21
2 years later, still the answer is not "ticked" ) This articles describes this one and 4 more common cases when this error occurs.
– Uzbekjon
Feb 14 '13 at 9:46
2
@Uzbekjon That solved it for me. The path to the script was wrong in one of myHTML
files.
– Adam Jensen
Oct 22 '14 at 5:46
@Jeremy, thanks a lot. Also put it before any partial view(mvc) so that it is available for any script in the partial.
– Andrew Day
Dec 9 '16 at 17:17
this solution is not working
– always-a-learner
Jul 9 '17 at 4:06
|
show 1 more comment
You should put the references to the jquery scripts first.
<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/sprinkle.js"></script>
22
Just to be sure this is clear: you cannot put the script reference to jquery-ui before the jquery script itself. That's what fixed the problem to me: first jquery-x.x.x.min.js, then jquery-ui-xxxxxx.js.
– wdanda
Nov 19 '10 at 1:05
21
2 years later, still the answer is not "ticked" ) This articles describes this one and 4 more common cases when this error occurs.
– Uzbekjon
Feb 14 '13 at 9:46
2
@Uzbekjon That solved it for me. The path to the script was wrong in one of myHTML
files.
– Adam Jensen
Oct 22 '14 at 5:46
@Jeremy, thanks a lot. Also put it before any partial view(mvc) so that it is available for any script in the partial.
– Andrew Day
Dec 9 '16 at 17:17
this solution is not working
– always-a-learner
Jul 9 '17 at 4:06
|
show 1 more comment
You should put the references to the jquery scripts first.
<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/sprinkle.js"></script>
You should put the references to the jquery scripts first.
<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/sprinkle.js"></script>
answered Jan 15 '10 at 23:08
JeremyJeremy
6,92921717
6,92921717
22
Just to be sure this is clear: you cannot put the script reference to jquery-ui before the jquery script itself. That's what fixed the problem to me: first jquery-x.x.x.min.js, then jquery-ui-xxxxxx.js.
– wdanda
Nov 19 '10 at 1:05
21
2 years later, still the answer is not "ticked" ) This articles describes this one and 4 more common cases when this error occurs.
– Uzbekjon
Feb 14 '13 at 9:46
2
@Uzbekjon That solved it for me. The path to the script was wrong in one of myHTML
files.
– Adam Jensen
Oct 22 '14 at 5:46
@Jeremy, thanks a lot. Also put it before any partial view(mvc) so that it is available for any script in the partial.
– Andrew Day
Dec 9 '16 at 17:17
this solution is not working
– always-a-learner
Jul 9 '17 at 4:06
|
show 1 more comment
22
Just to be sure this is clear: you cannot put the script reference to jquery-ui before the jquery script itself. That's what fixed the problem to me: first jquery-x.x.x.min.js, then jquery-ui-xxxxxx.js.
– wdanda
Nov 19 '10 at 1:05
21
2 years later, still the answer is not "ticked" ) This articles describes this one and 4 more common cases when this error occurs.
– Uzbekjon
Feb 14 '13 at 9:46
2
@Uzbekjon That solved it for me. The path to the script was wrong in one of myHTML
files.
– Adam Jensen
Oct 22 '14 at 5:46
@Jeremy, thanks a lot. Also put it before any partial view(mvc) so that it is available for any script in the partial.
– Andrew Day
Dec 9 '16 at 17:17
this solution is not working
– always-a-learner
Jul 9 '17 at 4:06
22
22
Just to be sure this is clear: you cannot put the script reference to jquery-ui before the jquery script itself. That's what fixed the problem to me: first jquery-x.x.x.min.js, then jquery-ui-xxxxxx.js.
– wdanda
Nov 19 '10 at 1:05
Just to be sure this is clear: you cannot put the script reference to jquery-ui before the jquery script itself. That's what fixed the problem to me: first jquery-x.x.x.min.js, then jquery-ui-xxxxxx.js.
– wdanda
Nov 19 '10 at 1:05
21
21
2 years later, still the answer is not "ticked" ) This articles describes this one and 4 more common cases when this error occurs.
– Uzbekjon
Feb 14 '13 at 9:46
2 years later, still the answer is not "ticked" ) This articles describes this one and 4 more common cases when this error occurs.
– Uzbekjon
Feb 14 '13 at 9:46
2
2
@Uzbekjon That solved it for me. The path to the script was wrong in one of my
HTML
files.– Adam Jensen
Oct 22 '14 at 5:46
@Uzbekjon That solved it for me. The path to the script was wrong in one of my
HTML
files.– Adam Jensen
Oct 22 '14 at 5:46
@Jeremy, thanks a lot. Also put it before any partial view(mvc) so that it is available for any script in the partial.
– Andrew Day
Dec 9 '16 at 17:17
@Jeremy, thanks a lot. Also put it before any partial view(mvc) so that it is available for any script in the partial.
– Andrew Day
Dec 9 '16 at 17:17
this solution is not working
– always-a-learner
Jul 9 '17 at 4:06
this solution is not working
– always-a-learner
Jul 9 '17 at 4:06
|
show 1 more comment
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
10
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
– Ram Sharma
Aug 21 '15 at 12:33
22
@RamSharma Actually, this is the right answer. You don't need anything else to solve the issue.
– Derek 朕會功夫
Nov 20 '15 at 20:21
Thanks a lot !!! worked for me.
– this is yash
Nov 22 '18 at 17:14
Yup. This was my problem. Simply had jquery AFTER referencing my js file. D'oh!
– daneiswork
Feb 7 at 11:49
add a comment |
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
10
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
– Ram Sharma
Aug 21 '15 at 12:33
22
@RamSharma Actually, this is the right answer. You don't need anything else to solve the issue.
– Derek 朕會功夫
Nov 20 '15 at 20:21
Thanks a lot !!! worked for me.
– this is yash
Nov 22 '18 at 17:14
Yup. This was my problem. Simply had jquery AFTER referencing my js file. D'oh!
– daneiswork
Feb 7 at 11:49
add a comment |
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
edited Feb 27 '18 at 10:07
code forever
275728
275728
answered Jan 15 '10 at 23:07
Open SourceOpen Source
2,1551104
2,1551104
10
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
– Ram Sharma
Aug 21 '15 at 12:33
22
@RamSharma Actually, this is the right answer. You don't need anything else to solve the issue.
– Derek 朕會功夫
Nov 20 '15 at 20:21
Thanks a lot !!! worked for me.
– this is yash
Nov 22 '18 at 17:14
Yup. This was my problem. Simply had jquery AFTER referencing my js file. D'oh!
– daneiswork
Feb 7 at 11:49
add a comment |
10
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
– Ram Sharma
Aug 21 '15 at 12:33
22
@RamSharma Actually, this is the right answer. You don't need anything else to solve the issue.
– Derek 朕會功夫
Nov 20 '15 at 20:21
Thanks a lot !!! worked for me.
– this is yash
Nov 22 '18 at 17:14
Yup. This was my problem. Simply had jquery AFTER referencing my js file. D'oh!
– daneiswork
Feb 7 at 11:49
10
10
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
– Ram Sharma
Aug 21 '15 at 12:33
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
– Ram Sharma
Aug 21 '15 at 12:33
22
22
@RamSharma Actually, this is the right answer. You don't need anything else to solve the issue.
– Derek 朕會功夫
Nov 20 '15 at 20:21
@RamSharma Actually, this is the right answer. You don't need anything else to solve the issue.
– Derek 朕會功夫
Nov 20 '15 at 20:21
Thanks a lot !!! worked for me.
– this is yash
Nov 22 '18 at 17:14
Thanks a lot !!! worked for me.
– this is yash
Nov 22 '18 at 17:14
Yup. This was my problem. Simply had jquery AFTER referencing my js file. D'oh!
– daneiswork
Feb 7 at 11:49
Yup. This was my problem. Simply had jquery AFTER referencing my js file. D'oh!
– daneiswork
Feb 7 at 11:49
add a comment |
This is what solved it for me. Originally I went to Google and copied and pasted their suggested snippet for jQuery on their CDN page:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
The snippet does not include the HTTP:
or HTTPS:
in the src
attribute but my browser, FireFox, needed it so I changed it to:
edit: this worked for me with Google Chrome as well
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Then it worked.
12
Strictly speaking the Google snippet/example is correct - their src attribute is a protocol less URL which means the browser should use the protocol (HTTP/HTTPS) of the calling page. See paulirish.com/2010/the-protocol-relative-url. This is best practice to avoid mixed content warnings if your page is ever served over SSL and the scripts are not.
– pwdst
Aug 11 '13 at 19:04
12
One common problem here, likely, is when protocol-relative URL's are used during development, and on a sunny day you try to load a page from a local file. Your browser will optimistically try to loadfile://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
and you wonder why it doesn't show up in the network console.
– Pieter Ennes
Apr 1 '14 at 15:02
thanks @PieterEnnes, this was exactly the case for me. Thanks to the answerer too!
– jwg
Aug 19 '14 at 16:01
add a comment |
This is what solved it for me. Originally I went to Google and copied and pasted their suggested snippet for jQuery on their CDN page:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
The snippet does not include the HTTP:
or HTTPS:
in the src
attribute but my browser, FireFox, needed it so I changed it to:
edit: this worked for me with Google Chrome as well
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Then it worked.
12
Strictly speaking the Google snippet/example is correct - their src attribute is a protocol less URL which means the browser should use the protocol (HTTP/HTTPS) of the calling page. See paulirish.com/2010/the-protocol-relative-url. This is best practice to avoid mixed content warnings if your page is ever served over SSL and the scripts are not.
– pwdst
Aug 11 '13 at 19:04
12
One common problem here, likely, is when protocol-relative URL's are used during development, and on a sunny day you try to load a page from a local file. Your browser will optimistically try to loadfile://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
and you wonder why it doesn't show up in the network console.
– Pieter Ennes
Apr 1 '14 at 15:02
thanks @PieterEnnes, this was exactly the case for me. Thanks to the answerer too!
– jwg
Aug 19 '14 at 16:01
add a comment |
This is what solved it for me. Originally I went to Google and copied and pasted their suggested snippet for jQuery on their CDN page:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
The snippet does not include the HTTP:
or HTTPS:
in the src
attribute but my browser, FireFox, needed it so I changed it to:
edit: this worked for me with Google Chrome as well
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Then it worked.
This is what solved it for me. Originally I went to Google and copied and pasted their suggested snippet for jQuery on their CDN page:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
The snippet does not include the HTTP:
or HTTPS:
in the src
attribute but my browser, FireFox, needed it so I changed it to:
edit: this worked for me with Google Chrome as well
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Then it worked.
edited Jan 9 at 5:25
amalamis
52
52
answered Mar 17 '13 at 17:50
Marlin MixonMarlin Mixon
96562
96562
12
Strictly speaking the Google snippet/example is correct - their src attribute is a protocol less URL which means the browser should use the protocol (HTTP/HTTPS) of the calling page. See paulirish.com/2010/the-protocol-relative-url. This is best practice to avoid mixed content warnings if your page is ever served over SSL and the scripts are not.
– pwdst
Aug 11 '13 at 19:04
12
One common problem here, likely, is when protocol-relative URL's are used during development, and on a sunny day you try to load a page from a local file. Your browser will optimistically try to loadfile://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
and you wonder why it doesn't show up in the network console.
– Pieter Ennes
Apr 1 '14 at 15:02
thanks @PieterEnnes, this was exactly the case for me. Thanks to the answerer too!
– jwg
Aug 19 '14 at 16:01
add a comment |
12
Strictly speaking the Google snippet/example is correct - their src attribute is a protocol less URL which means the browser should use the protocol (HTTP/HTTPS) of the calling page. See paulirish.com/2010/the-protocol-relative-url. This is best practice to avoid mixed content warnings if your page is ever served over SSL and the scripts are not.
– pwdst
Aug 11 '13 at 19:04
12
One common problem here, likely, is when protocol-relative URL's are used during development, and on a sunny day you try to load a page from a local file. Your browser will optimistically try to loadfile://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
and you wonder why it doesn't show up in the network console.
– Pieter Ennes
Apr 1 '14 at 15:02
thanks @PieterEnnes, this was exactly the case for me. Thanks to the answerer too!
– jwg
Aug 19 '14 at 16:01
12
12
Strictly speaking the Google snippet/example is correct - their src attribute is a protocol less URL which means the browser should use the protocol (HTTP/HTTPS) of the calling page. See paulirish.com/2010/the-protocol-relative-url. This is best practice to avoid mixed content warnings if your page is ever served over SSL and the scripts are not.
– pwdst
Aug 11 '13 at 19:04
Strictly speaking the Google snippet/example is correct - their src attribute is a protocol less URL which means the browser should use the protocol (HTTP/HTTPS) of the calling page. See paulirish.com/2010/the-protocol-relative-url. This is best practice to avoid mixed content warnings if your page is ever served over SSL and the scripts are not.
– pwdst
Aug 11 '13 at 19:04
12
12
One common problem here, likely, is when protocol-relative URL's are used during development, and on a sunny day you try to load a page from a local file. Your browser will optimistically try to load
file://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
and you wonder why it doesn't show up in the network console.– Pieter Ennes
Apr 1 '14 at 15:02
One common problem here, likely, is when protocol-relative URL's are used during development, and on a sunny day you try to load a page from a local file. Your browser will optimistically try to load
file://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
and you wonder why it doesn't show up in the network console.– Pieter Ennes
Apr 1 '14 at 15:02
thanks @PieterEnnes, this was exactly the case for me. Thanks to the answerer too!
– jwg
Aug 19 '14 at 16:01
thanks @PieterEnnes, this was exactly the case for me. Thanks to the answerer too!
– jwg
Aug 19 '14 at 16:01
add a comment |
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur. So, always keep your own JavaScript or jQuery code after calling the jQuery plugin so the solution for this is :
First add the link to the jQuery file hosted at GoogleApis or a local jQuery file that you will download from http://jquery.com/download/ and host on your server:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
or any plugin for jQuery. Then put your custom script file link or code:
<script src="js/custom.js" type="text/javascript"></script>
3
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur
the perfect answer.. in my case script was in footer
– echoashu
Nov 23 '14 at 16:23
add a comment |
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur. So, always keep your own JavaScript or jQuery code after calling the jQuery plugin so the solution for this is :
First add the link to the jQuery file hosted at GoogleApis or a local jQuery file that you will download from http://jquery.com/download/ and host on your server:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
or any plugin for jQuery. Then put your custom script file link or code:
<script src="js/custom.js" type="text/javascript"></script>
3
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur
the perfect answer.. in my case script was in footer
– echoashu
Nov 23 '14 at 16:23
add a comment |
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur. So, always keep your own JavaScript or jQuery code after calling the jQuery plugin so the solution for this is :
First add the link to the jQuery file hosted at GoogleApis or a local jQuery file that you will download from http://jquery.com/download/ and host on your server:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
or any plugin for jQuery. Then put your custom script file link or code:
<script src="js/custom.js" type="text/javascript"></script>
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur. So, always keep your own JavaScript or jQuery code after calling the jQuery plugin so the solution for this is :
First add the link to the jQuery file hosted at GoogleApis or a local jQuery file that you will download from http://jquery.com/download/ and host on your server:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
or any plugin for jQuery. Then put your custom script file link or code:
<script src="js/custom.js" type="text/javascript"></script>
edited Sep 3 '14 at 10:43
consuela
1,46751923
1,46751923
answered Jan 24 '14 at 11:46
JnanaranjanJnanaranjan
9761226
9761226
3
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur
the perfect answer.. in my case script was in footer
– echoashu
Nov 23 '14 at 16:23
add a comment |
3
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur
the perfect answer.. in my case script was in footer
– echoashu
Nov 23 '14 at 16:23
3
3
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur
the perfect answer.. in my case script was in footer– echoashu
Nov 23 '14 at 16:23
If your custom script is loaded before the jQuery plugin is loaded to the browser then this type of problem may occur
the perfect answer.. in my case script was in footer– echoashu
Nov 23 '14 at 16:23
add a comment |
In my case I was putting my .js
file before the jQuery script link, putting the .js
file after jQuery script link solved my issue.
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="exponential.js"></script>
Just used this to fix my jschart.
– indofraiser
Feb 13 '17 at 13:12
add a comment |
In my case I was putting my .js
file before the jQuery script link, putting the .js
file after jQuery script link solved my issue.
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="exponential.js"></script>
Just used this to fix my jschart.
– indofraiser
Feb 13 '17 at 13:12
add a comment |
In my case I was putting my .js
file before the jQuery script link, putting the .js
file after jQuery script link solved my issue.
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="exponential.js"></script>
In my case I was putting my .js
file before the jQuery script link, putting the .js
file after jQuery script link solved my issue.
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="exponential.js"></script>
edited Jun 21 '15 at 8:26
shivam
12.1k13551
12.1k13551
answered Dec 15 '14 at 2:55
user2719890
Just used this to fix my jschart.
– indofraiser
Feb 13 '17 at 13:12
add a comment |
Just used this to fix my jschart.
– indofraiser
Feb 13 '17 at 13:12
Just used this to fix my jschart.
– indofraiser
Feb 13 '17 at 13:12
Just used this to fix my jschart.
– indofraiser
Feb 13 '17 at 13:12
add a comment |
Okay, my problem was different - it was Document Security model in Chrome.
Looking at the answers here, it was obvious that I was somehow not loading my jquery files before calling the $(document).ready()
etc. functions. However, they were all in the correct positions.
In my case, this was because I was accessing the content over a secure HTTPS connection, whereas the page was trying to download the CDN hosted data from google, etc. The solution was to store them locally and then include then directly rather than from the CDN each time.
Edit: The other way of doing this is to link to all the CDN-hosted stuff as https:// rather than http:// - then the model doesn't complain.
5
Also, note that you can leave the protocol off links and it will choose the appropriate one depending on the context (assuming both http and https versions exist). See stackoverflow.com/a/3622615/4332
– Adrian Mouat
Aug 13 '13 at 13:53
yep. this one solved my problem, I was loading the scripts from an Url like this ´//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js´. Using ´cdnjs...´ works great
– xyz
Jun 23 '17 at 23:53
add a comment |
Okay, my problem was different - it was Document Security model in Chrome.
Looking at the answers here, it was obvious that I was somehow not loading my jquery files before calling the $(document).ready()
etc. functions. However, they were all in the correct positions.
In my case, this was because I was accessing the content over a secure HTTPS connection, whereas the page was trying to download the CDN hosted data from google, etc. The solution was to store them locally and then include then directly rather than from the CDN each time.
Edit: The other way of doing this is to link to all the CDN-hosted stuff as https:// rather than http:// - then the model doesn't complain.
5
Also, note that you can leave the protocol off links and it will choose the appropriate one depending on the context (assuming both http and https versions exist). See stackoverflow.com/a/3622615/4332
– Adrian Mouat
Aug 13 '13 at 13:53
yep. this one solved my problem, I was loading the scripts from an Url like this ´//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js´. Using ´cdnjs...´ works great
– xyz
Jun 23 '17 at 23:53
add a comment |
Okay, my problem was different - it was Document Security model in Chrome.
Looking at the answers here, it was obvious that I was somehow not loading my jquery files before calling the $(document).ready()
etc. functions. However, they were all in the correct positions.
In my case, this was because I was accessing the content over a secure HTTPS connection, whereas the page was trying to download the CDN hosted data from google, etc. The solution was to store them locally and then include then directly rather than from the CDN each time.
Edit: The other way of doing this is to link to all the CDN-hosted stuff as https:// rather than http:// - then the model doesn't complain.
Okay, my problem was different - it was Document Security model in Chrome.
Looking at the answers here, it was obvious that I was somehow not loading my jquery files before calling the $(document).ready()
etc. functions. However, they were all in the correct positions.
In my case, this was because I was accessing the content over a secure HTTPS connection, whereas the page was trying to download the CDN hosted data from google, etc. The solution was to store them locally and then include then directly rather than from the CDN each time.
Edit: The other way of doing this is to link to all the CDN-hosted stuff as https:// rather than http:// - then the model doesn't complain.
edited Mar 10 '13 at 0:52
answered Feb 19 '13 at 7:46
Sudipta ChatterjeeSudipta Chatterjee
3,28012130
3,28012130
5
Also, note that you can leave the protocol off links and it will choose the appropriate one depending on the context (assuming both http and https versions exist). See stackoverflow.com/a/3622615/4332
– Adrian Mouat
Aug 13 '13 at 13:53
yep. this one solved my problem, I was loading the scripts from an Url like this ´//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js´. Using ´cdnjs...´ works great
– xyz
Jun 23 '17 at 23:53
add a comment |
5
Also, note that you can leave the protocol off links and it will choose the appropriate one depending on the context (assuming both http and https versions exist). See stackoverflow.com/a/3622615/4332
– Adrian Mouat
Aug 13 '13 at 13:53
yep. this one solved my problem, I was loading the scripts from an Url like this ´//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js´. Using ´cdnjs...´ works great
– xyz
Jun 23 '17 at 23:53
5
5
Also, note that you can leave the protocol off links and it will choose the appropriate one depending on the context (assuming both http and https versions exist). See stackoverflow.com/a/3622615/4332
– Adrian Mouat
Aug 13 '13 at 13:53
Also, note that you can leave the protocol off links and it will choose the appropriate one depending on the context (assuming both http and https versions exist). See stackoverflow.com/a/3622615/4332
– Adrian Mouat
Aug 13 '13 at 13:53
yep. this one solved my problem, I was loading the scripts from an Url like this ´//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js´. Using ´cdnjs...´ works great
– xyz
Jun 23 '17 at 23:53
yep. this one solved my problem, I was loading the scripts from an Url like this ´//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js´. Using ´cdnjs...´ works great
– xyz
Jun 23 '17 at 23:53
add a comment |
Add the library before you start the script.You can add any of these following CDN to start it.
Google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Microsoft
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
Jquery
If you want any other Jquery cdn version check this link.
After this:
<script type="text/javascript">
$(function(){
//your stuff
});
or
$(document).ready(function(){
//your stuff
});
</script>
Wordpress:
<script type="text/javascript">
var $ = jQuery;
jQuery(document).ready(function($){
//your stuff
});
</script>
add a comment |
Add the library before you start the script.You can add any of these following CDN to start it.
Google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Microsoft
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
Jquery
If you want any other Jquery cdn version check this link.
After this:
<script type="text/javascript">
$(function(){
//your stuff
});
or
$(document).ready(function(){
//your stuff
});
</script>
Wordpress:
<script type="text/javascript">
var $ = jQuery;
jQuery(document).ready(function($){
//your stuff
});
</script>
add a comment |
Add the library before you start the script.You can add any of these following CDN to start it.
Google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Microsoft
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
Jquery
If you want any other Jquery cdn version check this link.
After this:
<script type="text/javascript">
$(function(){
//your stuff
});
or
$(document).ready(function(){
//your stuff
});
</script>
Wordpress:
<script type="text/javascript">
var $ = jQuery;
jQuery(document).ready(function($){
//your stuff
});
</script>
Add the library before you start the script.You can add any of these following CDN to start it.
Google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Microsoft
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
Jquery
If you want any other Jquery cdn version check this link.
After this:
<script type="text/javascript">
$(function(){
//your stuff
});
or
$(document).ready(function(){
//your stuff
});
</script>
Wordpress:
<script type="text/javascript">
var $ = jQuery;
jQuery(document).ready(function($){
//your stuff
});
</script>
edited Jul 20 '17 at 9:38
answered May 4 '17 at 10:17
lalithkumarlalithkumar
2,78921527
2,78921527
add a comment |
add a comment |
If it's in wordpress, might be needed to change
$(document).ready(function() {
to
jQuery(document).ready(function($){
or add
var $ = jQuery;
before
$(document).ready(function() {
add a comment |
If it's in wordpress, might be needed to change
$(document).ready(function() {
to
jQuery(document).ready(function($){
or add
var $ = jQuery;
before
$(document).ready(function() {
add a comment |
If it's in wordpress, might be needed to change
$(document).ready(function() {
to
jQuery(document).ready(function($){
or add
var $ = jQuery;
before
$(document).ready(function() {
If it's in wordpress, might be needed to change
$(document).ready(function() {
to
jQuery(document).ready(function($){
or add
var $ = jQuery;
before
$(document).ready(function() {
answered Jul 9 '15 at 8:27
xoxn-- 1'w3k4nxoxn-- 1'w3k4n
3751616
3751616
add a comment |
add a comment |
In my case I had this referenceError as the order of script calls was wrong. Solved that by changing the order:
<script src="js/index.js"></script>
<script src="js/jquery-1.10.2.js"></script>
to
<script src="js/jquery-1.10.2.js"></script>
<script src="js/index.js"></script>
1
Mostly this was the problem I too found when a reference error happens for '$'
– Dipak
Jun 9 '14 at 7:08
add a comment |
In my case I had this referenceError as the order of script calls was wrong. Solved that by changing the order:
<script src="js/index.js"></script>
<script src="js/jquery-1.10.2.js"></script>
to
<script src="js/jquery-1.10.2.js"></script>
<script src="js/index.js"></script>
1
Mostly this was the problem I too found when a reference error happens for '$'
– Dipak
Jun 9 '14 at 7:08
add a comment |
In my case I had this referenceError as the order of script calls was wrong. Solved that by changing the order:
<script src="js/index.js"></script>
<script src="js/jquery-1.10.2.js"></script>
to
<script src="js/jquery-1.10.2.js"></script>
<script src="js/index.js"></script>
In my case I had this referenceError as the order of script calls was wrong. Solved that by changing the order:
<script src="js/index.js"></script>
<script src="js/jquery-1.10.2.js"></script>
to
<script src="js/jquery-1.10.2.js"></script>
<script src="js/index.js"></script>
answered Feb 1 '14 at 13:57
Yannis DranYannis Dran
85111222
85111222
1
Mostly this was the problem I too found when a reference error happens for '$'
– Dipak
Jun 9 '14 at 7:08
add a comment |
1
Mostly this was the problem I too found when a reference error happens for '$'
– Dipak
Jun 9 '14 at 7:08
1
1
Mostly this was the problem I too found when a reference error happens for '$'
– Dipak
Jun 9 '14 at 7:08
Mostly this was the problem I too found when a reference error happens for '$'
– Dipak
Jun 9 '14 at 7:08
add a comment |
I had the exact same problem and none of these solutions above helped.
however, I just linked the .css
files after the .js
files and the problem miraculously disappeared. Hope this helps.
10
First, for better page rendering performance you should always link CSS files before JS files. Second, the order of css and js files should have no effect in the current cituation.
– Uzbekjon
Feb 14 '13 at 9:43
5
"What fixed your problem shouldn't fix your problem and you shouldn't do what fixed your problem."
– Andrew
Oct 21 '15 at 16:32
add a comment |
I had the exact same problem and none of these solutions above helped.
however, I just linked the .css
files after the .js
files and the problem miraculously disappeared. Hope this helps.
10
First, for better page rendering performance you should always link CSS files before JS files. Second, the order of css and js files should have no effect in the current cituation.
– Uzbekjon
Feb 14 '13 at 9:43
5
"What fixed your problem shouldn't fix your problem and you shouldn't do what fixed your problem."
– Andrew
Oct 21 '15 at 16:32
add a comment |
I had the exact same problem and none of these solutions above helped.
however, I just linked the .css
files after the .js
files and the problem miraculously disappeared. Hope this helps.
I had the exact same problem and none of these solutions above helped.
however, I just linked the .css
files after the .js
files and the problem miraculously disappeared. Hope this helps.
edited Jan 9 at 5:28
Narendra Jadhav
5,695111930
5,695111930
answered Jan 19 '11 at 12:55
crowickedcrowicked
52946
52946
10
First, for better page rendering performance you should always link CSS files before JS files. Second, the order of css and js files should have no effect in the current cituation.
– Uzbekjon
Feb 14 '13 at 9:43
5
"What fixed your problem shouldn't fix your problem and you shouldn't do what fixed your problem."
– Andrew
Oct 21 '15 at 16:32
add a comment |
10
First, for better page rendering performance you should always link CSS files before JS files. Second, the order of css and js files should have no effect in the current cituation.
– Uzbekjon
Feb 14 '13 at 9:43
5
"What fixed your problem shouldn't fix your problem and you shouldn't do what fixed your problem."
– Andrew
Oct 21 '15 at 16:32
10
10
First, for better page rendering performance you should always link CSS files before JS files. Second, the order of css and js files should have no effect in the current cituation.
– Uzbekjon
Feb 14 '13 at 9:43
First, for better page rendering performance you should always link CSS files before JS files. Second, the order of css and js files should have no effect in the current cituation.
– Uzbekjon
Feb 14 '13 at 9:43
5
5
"What fixed your problem shouldn't fix your problem and you shouldn't do what fixed your problem."
– Andrew
Oct 21 '15 at 16:32
"What fixed your problem shouldn't fix your problem and you shouldn't do what fixed your problem."
– Andrew
Oct 21 '15 at 16:32
add a comment |
I am proably the only person who had my kind of problem but ill put it down anyway. I wanted to try to make my script asynchronous just for the fun of it. Then i forgot about it and when i went live the [custom].js file only loaded 50% of the time before the jQuery.js.
So i changed
<script async src="js/script.js"></script>
to
<script src="js/script.js"></script>
:)
add a comment |
I am proably the only person who had my kind of problem but ill put it down anyway. I wanted to try to make my script asynchronous just for the fun of it. Then i forgot about it and when i went live the [custom].js file only loaded 50% of the time before the jQuery.js.
So i changed
<script async src="js/script.js"></script>
to
<script src="js/script.js"></script>
:)
add a comment |
I am proably the only person who had my kind of problem but ill put it down anyway. I wanted to try to make my script asynchronous just for the fun of it. Then i forgot about it and when i went live the [custom].js file only loaded 50% of the time before the jQuery.js.
So i changed
<script async src="js/script.js"></script>
to
<script src="js/script.js"></script>
:)
I am proably the only person who had my kind of problem but ill put it down anyway. I wanted to try to make my script asynchronous just for the fun of it. Then i forgot about it and when i went live the [custom].js file only loaded 50% of the time before the jQuery.js.
So i changed
<script async src="js/script.js"></script>
to
<script src="js/script.js"></script>
:)
answered May 2 '16 at 12:12
Sindri ÞórSindri Þór
1,80811929
1,80811929
add a comment |
add a comment |
If you are doing this in .Net and have the script file referenced properly and you jQuery looks fine, make sure that your users have access to the script file. The project I was working on (a coworker) had their web.config denying access to anonymous users. The page I was working on was accessible to anonymous users therefore they didn't have access to the script file. Dropped the following into the web.config and all was right in the world:
<location path="Scripts">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
add a comment |
If you are doing this in .Net and have the script file referenced properly and you jQuery looks fine, make sure that your users have access to the script file. The project I was working on (a coworker) had their web.config denying access to anonymous users. The page I was working on was accessible to anonymous users therefore they didn't have access to the script file. Dropped the following into the web.config and all was right in the world:
<location path="Scripts">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
add a comment |
If you are doing this in .Net and have the script file referenced properly and you jQuery looks fine, make sure that your users have access to the script file. The project I was working on (a coworker) had their web.config denying access to anonymous users. The page I was working on was accessible to anonymous users therefore they didn't have access to the script file. Dropped the following into the web.config and all was right in the world:
<location path="Scripts">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
If you are doing this in .Net and have the script file referenced properly and you jQuery looks fine, make sure that your users have access to the script file. The project I was working on (a coworker) had their web.config denying access to anonymous users. The page I was working on was accessible to anonymous users therefore they didn't have access to the script file. Dropped the following into the web.config and all was right in the world:
<location path="Scripts">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
answered Jun 26 '13 at 18:10
peroijaperoija
1,58431934
1,58431934
add a comment |
add a comment |
The source file jquery-1.2.6.min.js
is not called the jQuery command $()
is executed earlier than <..src='jquery-1.2.6.min.js'>
.
Please run <.. src="/js/jquery-1.2.6.min.js..">
at first and make sure the src path is right, then execute jquery command
$(document).ready(function()
add a comment |
The source file jquery-1.2.6.min.js
is not called the jQuery command $()
is executed earlier than <..src='jquery-1.2.6.min.js'>
.
Please run <.. src="/js/jquery-1.2.6.min.js..">
at first and make sure the src path is right, then execute jquery command
$(document).ready(function()
add a comment |
The source file jquery-1.2.6.min.js
is not called the jQuery command $()
is executed earlier than <..src='jquery-1.2.6.min.js'>
.
Please run <.. src="/js/jquery-1.2.6.min.js..">
at first and make sure the src path is right, then execute jquery command
$(document).ready(function()
The source file jquery-1.2.6.min.js
is not called the jQuery command $()
is executed earlier than <..src='jquery-1.2.6.min.js'>
.
Please run <.. src="/js/jquery-1.2.6.min.js..">
at first and make sure the src path is right, then execute jquery command
$(document).ready(function()
edited Sep 27 '12 at 12:52
Mihai Iorga
33.1k138193
33.1k138193
answered Aug 21 '12 at 12:05
charles hsucharles hsu
5911
5911
add a comment |
add a comment |
This happened to me before.
The reason was that I'm connecting android to a webview with a JS. And I sent a parameter without quotes.
js.sayHello(hello);
and when I changed it to
js.sayHello('hello');
it worked.
I've no idea what parameter without quotes means... it sounds like you had a reference error.
– Aluan Haddad
Mar 18 '17 at 5:02
I had a problem in Freemarker and the reason was absence of single quotes, so the value was treated not like a string, but as a variable
– torina
Apr 9 '18 at 17:02
add a comment |
This happened to me before.
The reason was that I'm connecting android to a webview with a JS. And I sent a parameter without quotes.
js.sayHello(hello);
and when I changed it to
js.sayHello('hello');
it worked.
I've no idea what parameter without quotes means... it sounds like you had a reference error.
– Aluan Haddad
Mar 18 '17 at 5:02
I had a problem in Freemarker and the reason was absence of single quotes, so the value was treated not like a string, but as a variable
– torina
Apr 9 '18 at 17:02
add a comment |
This happened to me before.
The reason was that I'm connecting android to a webview with a JS. And I sent a parameter without quotes.
js.sayHello(hello);
and when I changed it to
js.sayHello('hello');
it worked.
This happened to me before.
The reason was that I'm connecting android to a webview with a JS. And I sent a parameter without quotes.
js.sayHello(hello);
and when I changed it to
js.sayHello('hello');
it worked.
answered Sep 13 '13 at 8:16
ReinherdReinherd
2,95853977
2,95853977
I've no idea what parameter without quotes means... it sounds like you had a reference error.
– Aluan Haddad
Mar 18 '17 at 5:02
I had a problem in Freemarker and the reason was absence of single quotes, so the value was treated not like a string, but as a variable
– torina
Apr 9 '18 at 17:02
add a comment |
I've no idea what parameter without quotes means... it sounds like you had a reference error.
– Aluan Haddad
Mar 18 '17 at 5:02
I had a problem in Freemarker and the reason was absence of single quotes, so the value was treated not like a string, but as a variable
– torina
Apr 9 '18 at 17:02
I've no idea what parameter without quotes means... it sounds like you had a reference error.
– Aluan Haddad
Mar 18 '17 at 5:02
I've no idea what parameter without quotes means... it sounds like you had a reference error.
– Aluan Haddad
Mar 18 '17 at 5:02
I had a problem in Freemarker and the reason was absence of single quotes, so the value was treated not like a string, but as a variable
– torina
Apr 9 '18 at 17:02
I had a problem in Freemarker and the reason was absence of single quotes, so the value was treated not like a string, but as a variable
– torina
Apr 9 '18 at 17:02
add a comment |
Your JavaScript file is missing so this error occurred. Just add the JavaScript file inside the <head>
tag. See the example:
<script src="js/sample.js" type="text/javascript"></script>
<link href="css/sample.css" rel="stylesheet" type="text/css" />
or add the following code in tag :
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
add a comment |
Your JavaScript file is missing so this error occurred. Just add the JavaScript file inside the <head>
tag. See the example:
<script src="js/sample.js" type="text/javascript"></script>
<link href="css/sample.css" rel="stylesheet" type="text/css" />
or add the following code in tag :
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
add a comment |
Your JavaScript file is missing so this error occurred. Just add the JavaScript file inside the <head>
tag. See the example:
<script src="js/sample.js" type="text/javascript"></script>
<link href="css/sample.css" rel="stylesheet" type="text/css" />
or add the following code in tag :
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Your JavaScript file is missing so this error occurred. Just add the JavaScript file inside the <head>
tag. See the example:
<script src="js/sample.js" type="text/javascript"></script>
<link href="css/sample.css" rel="stylesheet" type="text/css" />
or add the following code in tag :
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
edited May 28 '13 at 6:01
answered May 14 '13 at 11:16
Gaurav GuptaGaurav Gupta
26238
26238
add a comment |
add a comment |
In my case it was a typo, I forgot a backslash and was referencing the source incorrectly.
Before src="/scripts/jquery.js"
After src="scripts/jquery.js"
add a comment |
In my case it was a typo, I forgot a backslash and was referencing the source incorrectly.
Before src="/scripts/jquery.js"
After src="scripts/jquery.js"
add a comment |
In my case it was a typo, I forgot a backslash and was referencing the source incorrectly.
Before src="/scripts/jquery.js"
After src="scripts/jquery.js"
In my case it was a typo, I forgot a backslash and was referencing the source incorrectly.
Before src="/scripts/jquery.js"
After src="scripts/jquery.js"
edited Sep 4 '14 at 15:42
answered Apr 17 '11 at 5:28
DennisDennis
30.8k18105106
30.8k18105106
add a comment |
add a comment |
The error will occur in the following two scenarios as well.
- @section scripts element is missing from the HTML file
- Error in accessing DOM elements. For example accessing of DOM element is mentioned as $("js-toggle") instead of $(".js-toggle"). Actually the period is missing
So 3 things to be followed - check required scripts are added, check if it is added in the required order and third syntax errors in your Java Script.
Yeah. and for id attributes $('#someDiv')
– CagCak
Apr 28 '17 at 22:36
Up Vote for your ASP.NET MVC @section scripts pointer
– Nattrass
Jun 23 '17 at 9:57
add a comment |
The error will occur in the following two scenarios as well.
- @section scripts element is missing from the HTML file
- Error in accessing DOM elements. For example accessing of DOM element is mentioned as $("js-toggle") instead of $(".js-toggle"). Actually the period is missing
So 3 things to be followed - check required scripts are added, check if it is added in the required order and third syntax errors in your Java Script.
Yeah. and for id attributes $('#someDiv')
– CagCak
Apr 28 '17 at 22:36
Up Vote for your ASP.NET MVC @section scripts pointer
– Nattrass
Jun 23 '17 at 9:57
add a comment |
The error will occur in the following two scenarios as well.
- @section scripts element is missing from the HTML file
- Error in accessing DOM elements. For example accessing of DOM element is mentioned as $("js-toggle") instead of $(".js-toggle"). Actually the period is missing
So 3 things to be followed - check required scripts are added, check if it is added in the required order and third syntax errors in your Java Script.
The error will occur in the following two scenarios as well.
- @section scripts element is missing from the HTML file
- Error in accessing DOM elements. For example accessing of DOM element is mentioned as $("js-toggle") instead of $(".js-toggle"). Actually the period is missing
So 3 things to be followed - check required scripts are added, check if it is added in the required order and third syntax errors in your Java Script.
answered Jul 13 '16 at 6:53
Sankar KrishnamoorthySankar Krishnamoorthy
707717
707717
Yeah. and for id attributes $('#someDiv')
– CagCak
Apr 28 '17 at 22:36
Up Vote for your ASP.NET MVC @section scripts pointer
– Nattrass
Jun 23 '17 at 9:57
add a comment |
Yeah. and for id attributes $('#someDiv')
– CagCak
Apr 28 '17 at 22:36
Up Vote for your ASP.NET MVC @section scripts pointer
– Nattrass
Jun 23 '17 at 9:57
Yeah. and for id attributes $('#someDiv')
– CagCak
Apr 28 '17 at 22:36
Yeah. and for id attributes $('#someDiv')
– CagCak
Apr 28 '17 at 22:36
Up Vote for your ASP.NET MVC @section scripts pointer
– Nattrass
Jun 23 '17 at 9:57
Up Vote for your ASP.NET MVC @section scripts pointer
– Nattrass
Jun 23 '17 at 9:57
add a comment |
Doh! I had mixed quotes in my tags that caused the jquery reference to break. Doing an inspect in Chrome allowed me to see that the file wasn't properly linked.
add a comment |
Doh! I had mixed quotes in my tags that caused the jquery reference to break. Doing an inspect in Chrome allowed me to see that the file wasn't properly linked.
add a comment |
Doh! I had mixed quotes in my tags that caused the jquery reference to break. Doing an inspect in Chrome allowed me to see that the file wasn't properly linked.
Doh! I had mixed quotes in my tags that caused the jquery reference to break. Doing an inspect in Chrome allowed me to see that the file wasn't properly linked.
answered Jun 25 '12 at 17:36
justreedjustreed
574
574
add a comment |
add a comment |
In my case i forgot to include this :
<script src ="jquery-2.1.1.js"></script>
Earlier I was including just jquery-mobile which was causing this error.
add a comment |
In my case i forgot to include this :
<script src ="jquery-2.1.1.js"></script>
Earlier I was including just jquery-mobile which was causing this error.
add a comment |
In my case i forgot to include this :
<script src ="jquery-2.1.1.js"></script>
Earlier I was including just jquery-mobile which was causing this error.
In my case i forgot to include this :
<script src ="jquery-2.1.1.js"></script>
Earlier I was including just jquery-mobile which was causing this error.
answered Jun 21 '14 at 14:12
AnandAnand
8651917
8651917
add a comment |
add a comment |
Ok I admit this one was a really dumb thing that happend once to me. I modified the script tag to point to the right content and changed the script order to be the right one in the editor ... but totally forgot to save the change ;( You might laugh now but when you're tired all sort of strange problems might happen. I
add a comment |
Ok I admit this one was a really dumb thing that happend once to me. I modified the script tag to point to the right content and changed the script order to be the right one in the editor ... but totally forgot to save the change ;( You might laugh now but when you're tired all sort of strange problems might happen. I
add a comment |
Ok I admit this one was a really dumb thing that happend once to me. I modified the script tag to point to the right content and changed the script order to be the right one in the editor ... but totally forgot to save the change ;( You might laugh now but when you're tired all sort of strange problems might happen. I
Ok I admit this one was a really dumb thing that happend once to me. I modified the script tag to point to the right content and changed the script order to be the right one in the editor ... but totally forgot to save the change ;( You might laugh now but when you're tired all sort of strange problems might happen. I
answered Apr 30 '17 at 18:56
HexodusHexodus
4,12642950
4,12642950
add a comment |
add a comment |
I had a similar issue and it was because I was missing a closing > on a style sheet link.
add a comment |
I had a similar issue and it was because I was missing a closing > on a style sheet link.
add a comment |
I had a similar issue and it was because I was missing a closing > on a style sheet link.
I had a similar issue and it was because I was missing a closing > on a style sheet link.
answered Mar 10 '14 at 17:13
jasonjason
711827
711827
add a comment |
add a comment |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="local_xxx.js"></script>
I have similar issue, and you know what, it's because of network is disconnected when I test in android device webview and I don't realize it, and the local js no problem to load because it doesn't need network. It seems ridiculous but it waste my ~1 hour to figure out it.
add a comment |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="local_xxx.js"></script>
I have similar issue, and you know what, it's because of network is disconnected when I test in android device webview and I don't realize it, and the local js no problem to load because it doesn't need network. It seems ridiculous but it waste my ~1 hour to figure out it.
add a comment |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="local_xxx.js"></script>
I have similar issue, and you know what, it's because of network is disconnected when I test in android device webview and I don't realize it, and the local js no problem to load because it doesn't need network. It seems ridiculous but it waste my ~1 hour to figure out it.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="local_xxx.js"></script>
I have similar issue, and you know what, it's because of network is disconnected when I test in android device webview and I don't realize it, and the local js no problem to load because it doesn't need network. It seems ridiculous but it waste my ~1 hour to figure out it.
answered May 5 '17 at 8:51
林果皞林果皞
4,45122444
4,45122444
add a comment |
add a comment |
Strange enough, my problem was coming from PHP.
A REST API call was failing, and it was breaking the loading of the libraries afterwards. Since failure was from the REST call, it was not giving me a php compile error.
Keep this as an option also, if loading jquery seems ok.
add a comment |
Strange enough, my problem was coming from PHP.
A REST API call was failing, and it was breaking the loading of the libraries afterwards. Since failure was from the REST call, it was not giving me a php compile error.
Keep this as an option also, if loading jquery seems ok.
add a comment |
Strange enough, my problem was coming from PHP.
A REST API call was failing, and it was breaking the loading of the libraries afterwards. Since failure was from the REST call, it was not giving me a php compile error.
Keep this as an option also, if loading jquery seems ok.
Strange enough, my problem was coming from PHP.
A REST API call was failing, and it was breaking the loading of the libraries afterwards. Since failure was from the REST call, it was not giving me a php compile error.
Keep this as an option also, if loading jquery seems ok.
answered Mar 11 '14 at 12:30
ArisAris
2,82112128
2,82112128
add a comment |
add a comment |
I had this issue, when I was browsing internet through my mobile hotspot. it was also compressing images and added the following script at the bottom of body tag
<script language="javascript"><!--
bmi_SafeAddOnload(bmi_load,"bmi_orig_img");//-->
</script>
When I connected to proper wifi connection, all seems to work find for me. Hope this help someone.
add a comment |
I had this issue, when I was browsing internet through my mobile hotspot. it was also compressing images and added the following script at the bottom of body tag
<script language="javascript"><!--
bmi_SafeAddOnload(bmi_load,"bmi_orig_img");//-->
</script>
When I connected to proper wifi connection, all seems to work find for me. Hope this help someone.
add a comment |
I had this issue, when I was browsing internet through my mobile hotspot. it was also compressing images and added the following script at the bottom of body tag
<script language="javascript"><!--
bmi_SafeAddOnload(bmi_load,"bmi_orig_img");//-->
</script>
When I connected to proper wifi connection, all seems to work find for me. Hope this help someone.
I had this issue, when I was browsing internet through my mobile hotspot. it was also compressing images and added the following script at the bottom of body tag
<script language="javascript"><!--
bmi_SafeAddOnload(bmi_load,"bmi_orig_img");//-->
</script>
When I connected to proper wifi connection, all seems to work find for me. Hope this help someone.
answered May 28 '14 at 15:18
bubbbubb
48943
48943
add a comment |
add a comment |
I had similar issue. My test server was working fine with "http". However it failed in production which had SSL.
Thus in production, I added "HTPPS" instead of "HTTP" and in test, i kept as it is "HTTP".
Test:
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Production:
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Hope this will help someone who is working on wordpress.
add a comment |
I had similar issue. My test server was working fine with "http". However it failed in production which had SSL.
Thus in production, I added "HTPPS" instead of "HTTP" and in test, i kept as it is "HTTP".
Test:
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Production:
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Hope this will help someone who is working on wordpress.
add a comment |
I had similar issue. My test server was working fine with "http". However it failed in production which had SSL.
Thus in production, I added "HTPPS" instead of "HTTP" and in test, i kept as it is "HTTP".
Test:
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Production:
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Hope this will help someone who is working on wordpress.
I had similar issue. My test server was working fine with "http". However it failed in production which had SSL.
Thus in production, I added "HTPPS" instead of "HTTP" and in test, i kept as it is "HTTP".
Test:
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Production:
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array(), null, false );
wp_register_script( 'custom-script', plugins_url( '/js/custom.js', FILE ), array( 'jquery' ) );
Hope this will help someone who is working on wordpress.
answered Apr 10 '15 at 1:56
user3671115user3671115
3616
3616
add a comment |
add a comment |
This can also happen, if there is network issue. Which means, that even though the " jquery scripts " are in place, and are included prior to usage, since the jquery-scripts are not accessible, at the time of loading the page, hence the definitions to the "$" are treated as "undefined references".
FOR TEST/DEBUG PURPOSES :: You can try to access the "jquery-script" url on browser. If it is accessible, your page, should load properly, else it will show the said error (or other script relevant errors). Example - http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js should be accessible, on the browser (or browser context stances).
I had similar problem, in which I was able to load the html-page (using scripts) in my windows-host-browser, but was not able to load in vm-ubuntu. Solving the network issue, got the issue resolved.
add a comment |
This can also happen, if there is network issue. Which means, that even though the " jquery scripts " are in place, and are included prior to usage, since the jquery-scripts are not accessible, at the time of loading the page, hence the definitions to the "$" are treated as "undefined references".
FOR TEST/DEBUG PURPOSES :: You can try to access the "jquery-script" url on browser. If it is accessible, your page, should load properly, else it will show the said error (or other script relevant errors). Example - http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js should be accessible, on the browser (or browser context stances).
I had similar problem, in which I was able to load the html-page (using scripts) in my windows-host-browser, but was not able to load in vm-ubuntu. Solving the network issue, got the issue resolved.
add a comment |
This can also happen, if there is network issue. Which means, that even though the " jquery scripts " are in place, and are included prior to usage, since the jquery-scripts are not accessible, at the time of loading the page, hence the definitions to the "$" are treated as "undefined references".
FOR TEST/DEBUG PURPOSES :: You can try to access the "jquery-script" url on browser. If it is accessible, your page, should load properly, else it will show the said error (or other script relevant errors). Example - http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js should be accessible, on the browser (or browser context stances).
I had similar problem, in which I was able to load the html-page (using scripts) in my windows-host-browser, but was not able to load in vm-ubuntu. Solving the network issue, got the issue resolved.
This can also happen, if there is network issue. Which means, that even though the " jquery scripts " are in place, and are included prior to usage, since the jquery-scripts are not accessible, at the time of loading the page, hence the definitions to the "$" are treated as "undefined references".
FOR TEST/DEBUG PURPOSES :: You can try to access the "jquery-script" url on browser. If it is accessible, your page, should load properly, else it will show the said error (or other script relevant errors). Example - http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js should be accessible, on the browser (or browser context stances).
I had similar problem, in which I was able to load the html-page (using scripts) in my windows-host-browser, but was not able to load in vm-ubuntu. Solving the network issue, got the issue resolved.
answered Apr 5 '16 at 14:03
parasrishparasrish
1,9911521
1,9911521
add a comment |
add a comment |
var $ = jQuery;
jQuery(document).ready(function($){
1
This is absolutely not an answer. You have to add some explanations.
– jml
Apr 14 '17 at 12:07
This is a solution forWordpress
you should mention that.
– Hexodus
May 2 '17 at 17:23
You saved my day. Was struggling to do it in WordPress and none but this solution worked like a charm.
– rahimv
May 8 '17 at 14:19
add a comment |
var $ = jQuery;
jQuery(document).ready(function($){
1
This is absolutely not an answer. You have to add some explanations.
– jml
Apr 14 '17 at 12:07
This is a solution forWordpress
you should mention that.
– Hexodus
May 2 '17 at 17:23
You saved my day. Was struggling to do it in WordPress and none but this solution worked like a charm.
– rahimv
May 8 '17 at 14:19
add a comment |
var $ = jQuery;
jQuery(document).ready(function($){
var $ = jQuery;
jQuery(document).ready(function($){
answered Apr 14 '17 at 11:31
Jayanit SataniJayanit Satani
1237
1237
1
This is absolutely not an answer. You have to add some explanations.
– jml
Apr 14 '17 at 12:07
This is a solution forWordpress
you should mention that.
– Hexodus
May 2 '17 at 17:23
You saved my day. Was struggling to do it in WordPress and none but this solution worked like a charm.
– rahimv
May 8 '17 at 14:19
add a comment |
1
This is absolutely not an answer. You have to add some explanations.
– jml
Apr 14 '17 at 12:07
This is a solution forWordpress
you should mention that.
– Hexodus
May 2 '17 at 17:23
You saved my day. Was struggling to do it in WordPress and none but this solution worked like a charm.
– rahimv
May 8 '17 at 14:19
1
1
This is absolutely not an answer. You have to add some explanations.
– jml
Apr 14 '17 at 12:07
This is absolutely not an answer. You have to add some explanations.
– jml
Apr 14 '17 at 12:07
This is a solution for
Wordpress
you should mention that.– Hexodus
May 2 '17 at 17:23
This is a solution for
Wordpress
you should mention that.– Hexodus
May 2 '17 at 17:23
You saved my day. Was struggling to do it in WordPress and none but this solution worked like a charm.
– rahimv
May 8 '17 at 14:19
You saved my day. Was struggling to do it in WordPress and none but this solution worked like a charm.
– rahimv
May 8 '17 at 14:19
add a comment |
I had the same problem , and I solved by putting jQuery at the top of all javascript codes I have in my code.
Something like this:
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="js/app.js" type="text/javascript"></script>
<script src="js/form.js" type="text/javascript"></script>
<script src="js/create.js" type="text/javascript"></script>
<script src="js/tween.js" type="text/javascript"></script>
Hope can help some one in future.
add a comment |
I had the same problem , and I solved by putting jQuery at the top of all javascript codes I have in my code.
Something like this:
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="js/app.js" type="text/javascript"></script>
<script src="js/form.js" type="text/javascript"></script>
<script src="js/create.js" type="text/javascript"></script>
<script src="js/tween.js" type="text/javascript"></script>
Hope can help some one in future.
add a comment |
I had the same problem , and I solved by putting jQuery at the top of all javascript codes I have in my code.
Something like this:
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="js/app.js" type="text/javascript"></script>
<script src="js/form.js" type="text/javascript"></script>
<script src="js/create.js" type="text/javascript"></script>
<script src="js/tween.js" type="text/javascript"></script>
Hope can help some one in future.
I had the same problem , and I solved by putting jQuery at the top of all javascript codes I have in my code.
Something like this:
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="js/app.js" type="text/javascript"></script>
<script src="js/form.js" type="text/javascript"></script>
<script src="js/create.js" type="text/javascript"></script>
<script src="js/tween.js" type="text/javascript"></script>
Hope can help some one in future.
edited Dec 15 '18 at 7:20
marc_s
578k12911161261
578k12911161261
answered Dec 12 '18 at 23:46
user9964622user9964622
1,18511237
1,18511237
add a comment |
add a comment |
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
If you're in ASP.NET MVC, you can specify when your JS code should be rendered, by doing this:
1, In your page.cshtml
wrap your <script>
tag into a section, and give it a name, the common name to use is 'scripts':
@section scripts {
<script>
// JS code...
</script>
}
2, In your _Layout.cshtml
page add @RenderSection("Scripts", required: false)
, make sure to put it after you reference the Jquery source, this will make your JS code render later than the Jquery.
add a comment |
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
If you're in ASP.NET MVC, you can specify when your JS code should be rendered, by doing this:
1, In your page.cshtml
wrap your <script>
tag into a section, and give it a name, the common name to use is 'scripts':
@section scripts {
<script>
// JS code...
</script>
}
2, In your _Layout.cshtml
page add @RenderSection("Scripts", required: false)
, make sure to put it after you reference the Jquery source, this will make your JS code render later than the Jquery.
add a comment |
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
If you're in ASP.NET MVC, you can specify when your JS code should be rendered, by doing this:
1, In your page.cshtml
wrap your <script>
tag into a section, and give it a name, the common name to use is 'scripts':
@section scripts {
<script>
// JS code...
</script>
}
2, In your _Layout.cshtml
page add @RenderSection("Scripts", required: false)
, make sure to put it after you reference the Jquery source, this will make your JS code render later than the Jquery.
You are calling the ready function before the jQuery JavaScript is included. Reference jQuery first.
If you're in ASP.NET MVC, you can specify when your JS code should be rendered, by doing this:
1, In your page.cshtml
wrap your <script>
tag into a section, and give it a name, the common name to use is 'scripts':
@section scripts {
<script>
// JS code...
</script>
}
2, In your _Layout.cshtml
page add @RenderSection("Scripts", required: false)
, make sure to put it after you reference the Jquery source, this will make your JS code render later than the Jquery.
answered Dec 26 '18 at 16:14
Mayer SpitzerMayer Spitzer
601314
601314
add a comment |
add a comment |
Root problem is a ReferenceError
. MDN indicates that a try
/catch
block is the proper tool for the job. In my case, I was getting uncaught reference error for a payment sdk/library. The below works for me.
try {
var stripe = Stripe('pk_test_---------');
} catch (e) {
stripe = null;
}
if(stripe){
//we are good to go now
}
Obviously the fix is to load whatever SDK/library, e.g. jQuery, prior to calling its methods but the try
/catch
does keep your shared JavaScript from barfing up errors in case you run that shared script on a page that doesn't load whatever library you use on a subset of pages.
add a comment |
Root problem is a ReferenceError
. MDN indicates that a try
/catch
block is the proper tool for the job. In my case, I was getting uncaught reference error for a payment sdk/library. The below works for me.
try {
var stripe = Stripe('pk_test_---------');
} catch (e) {
stripe = null;
}
if(stripe){
//we are good to go now
}
Obviously the fix is to load whatever SDK/library, e.g. jQuery, prior to calling its methods but the try
/catch
does keep your shared JavaScript from barfing up errors in case you run that shared script on a page that doesn't load whatever library you use on a subset of pages.
add a comment |
Root problem is a ReferenceError
. MDN indicates that a try
/catch
block is the proper tool for the job. In my case, I was getting uncaught reference error for a payment sdk/library. The below works for me.
try {
var stripe = Stripe('pk_test_---------');
} catch (e) {
stripe = null;
}
if(stripe){
//we are good to go now
}
Obviously the fix is to load whatever SDK/library, e.g. jQuery, prior to calling its methods but the try
/catch
does keep your shared JavaScript from barfing up errors in case you run that shared script on a page that doesn't load whatever library you use on a subset of pages.
Root problem is a ReferenceError
. MDN indicates that a try
/catch
block is the proper tool for the job. In my case, I was getting uncaught reference error for a payment sdk/library. The below works for me.
try {
var stripe = Stripe('pk_test_---------');
} catch (e) {
stripe = null;
}
if(stripe){
//we are good to go now
}
Obviously the fix is to load whatever SDK/library, e.g. jQuery, prior to calling its methods but the try
/catch
does keep your shared JavaScript from barfing up errors in case you run that shared script on a page that doesn't load whatever library you use on a subset of pages.
answered Jun 21 '18 at 0:45
Ron RoystonRon Royston
6,33732643
6,33732643
add a comment |
add a comment |
1 2
next
protected by Community♦ Aug 21 '13 at 5:56
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script> Take this on top
– captainsac
Jun 10 '15 at 7:44
Maybe sometime calling the ready function before the JQuery loads then this error may occurs
– Sagar Naliyapara
Apr 25 '17 at 11:44