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

Home Forums JavaScript JQuery Best Practices

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #28678

    So I’ve been religiously following Chris and some other sources in my quest to learn JQuery. I am a front-end guy (photoshop, HTML and CSS). But, hey, this JQuery stuff seems so simple that even I could do it. For the most part it is pretty straightforward and most of the issues I’ve encountered have answers to them on some forum somewhere. What I’ve noticed a lot of people having issues with (including myself) and what I have yet to see a clear answer to is what to do when scripts (or calls to different JQuery library versions) interfere or overwrite each other. For example, you might want "organic tabs" and a "slideshow" on the the same HTML page, but they won’t work together. Individually they run great. You check your code, you change the order of the scripts on the page, etc. , you go your web sources, but everyone seems to have partial answers or answers that just don’t work.

    Is there a Jquery best practices resource that would explain why this happens or how you should include javascript and calls to Jquery libraries so these conflicts don’t happen?

    Can you just not run so many jquery calls on one page?

    Should I stick to front-end development and leave the Javascript to the experts?

    Thank you.


    I actually found some answers on this (thanks to Chris Coyier for his help).

    You should only be using one version of Jquery per page. This was my biggest issue. So don’t call in version 1.3.2 and 1.4.2 on the same page. Version 1.4.2 should cover anything that is in 1.3.2.

    Also, in your header you should order:
    1)style sheet call
    2)library call (jquery 1.4.2 for example)
    3) specific script calls (spasticNav.js for example)

    Also, if you need to use another JavaScript library alongside jQuery you can use jQuery.noConflict()
    I will not pretend that I am expert enough to understand this method, but it might prove useful down the road.

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