Get a free trial // Grow your CSS skills // Land your dream job

jquery script include question

  • # December 8, 2009 at 3:26 pm

    Hey folks,

    I just had an odd question and was wondering if this is something I’m missing, or it’s something that just differs per host.

    I’ve started going through more learning in jquery, and one thing that I notice many people do is that they include the .js file, and then instead of putting the code right on the page, they include it as another .js file.

    So instead of this


    You’d just have this:

    slide.js code:

    $(function() {

    page code:


    So here’s the question: when I include a file like ‘slide.js’, it works perfectly on my localhost, but I can’t seem to get my actual hosting provider to get it to work. When I upload the files, and then test it, nothing happens. It’s only when I put the code right on the page (like the first jquery script) does it work.

    Why does it work on my localhost and not on a provider hosted server?

    # December 8, 2009 at 4:37 pm

    You have to make sure your path is right – and you have actually uploaded your JS file too :) things like that. Lots of reasons why, but my first thought would be file path – do you have a live link? Oh and check you uploaded the jQuery file too :)

    # December 8, 2009 at 11:00 pm

    False alarm I guess… I seriously spent like 20 minutes yesterday messing with it and I re-uploaded the example I’m working with and it’s working fine. Must have been one of those instances where it’s just some dumb simple thing and you just are totally missing it :)

    The link is if you wanted to see it. It’s the "Search Site" slider for the searchbar.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed