Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jquery script include question

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #27130

    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

    Code:

    You’d just have this:

    slide.js code:

    Code:
    $(function() {
    $(‘a.search’).click(function(){
    $(‘#searchbox’).slideDown();
    });
    });

    page code:

    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?

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.