Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8">

function switch01(){
    $("#con01,#con02,#con03").hide();  
    $("#con04").slideToggle("slow");
};

As I understand, the above code is jQuery code, and it needs the first - reference line to work at all.
For example, CSS code will not work without a reference to a css file (if not inline placed).
But I removed the first line (accidentally), and what I see - the code still works.
Does maybe browser has jQuery inside itself ?
If so - why one can need the above line at all ?
And if so - what about priority issue (in case version's conflict between the referencing and browser's library ?
And, if not so - where is the library placed ?
Maybe - in the eternal, ever-present Universe :).
Or maybe - something is wrong in my understanding (probably).

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Most likely it would be your browser caching it, actually. Try a force-refresh with SHIFT+F5 a few times.

However, looking at that as it stands - it is invalid script and I am surprised it ever worked.

(unless you're pulling it out of context..?)

On most browsers today pressing CTRL+SHIFT+DEL will pop the "Clear Cache Dialog", where you can specify what you want cleared.

share|improve this answer
    
I have Firefoks 17 and clear the cache with F5. The code still works –  Alegro Nov 30 '12 at 15:50
    
Just F5 doesn't clear the cache. It would be worth doing the full cache clear, or just trying another browser you've not visited the page on. –  nerdwaller Nov 30 '12 at 15:51
    
Now I cleared the cache following this instructions: http://support.mozilla.org/en-US/kb/how-clear-firefox-cache. The code still works. –  Alegro Nov 30 '12 at 16:00
    
The assets are definitely coming in somehow. Very odd. –  nerdwaller Nov 30 '12 at 16:05
    
What about WAMP server. My page is .php. Should I clear something in WAMP - and how? –  Alegro Nov 30 '12 at 16:13

The code you posted will not work without jQuery or simliar JS framework. If it works without the first line where you're including the jQuery library, then it may also be loaded by something else. Browsers do not include the jQuery library by default.

You can look in the Chrome inspector or Firefox's Firebug to view the resources that are being loaded; see if you can find jQuery in that list.

share|improve this answer

Caching, probably. Clear the browser's cache and see what happens. The instructions for clearing the cache depend on the browser in question.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.