Tuesday, March 11, 2014

jQuery Coding Standards and Best Practices

I’ve been using jQuery for the past couple of years and have seen a lot of bad practices and lack of standards knowledge between the developers. It’s always better to have standards defined around big teams so everyone’s on the same page. I took this effort to unify the coding standards and best practices around jQuery under one page so others can build upon it. Not all standards may apply to your application so feel free to use whatever works best for your application domain.


If you find any mistakes, have any suggestions or comments, please feel free to drop a word below this post and I’ll try to address it as soon as possible.


  1. Have you considered a wiki page on GitHub? That would make it easier to report issues or suggest improvements.

  2. I stopped at "use IDs whenever possible". I strongly disagree, I hope to have time one day to write why.

    1. Now i'm curious why do you desagree in using IDs whenever possible... i see the point in the post (which is really usefull) and i kinda agree with him... I'd love to know what is your argument for your opinion.

    2. we want to know!!

    3. Yeah! Been there, done that with ID's.....Your post is really kind man!

  3. Are you kidding me?
    When using class/pseudo selectors, always use the element type in your selector to avoid scanning of all DOM elements.

  4. Very useful recommendations. The only exception for me was the "Avoid Excessive Specificity". For me, using Chrome 33.0.1750.152 on Linux 64-bit, the more you specify your selector the fastest it'll be. Although the performance gain it not that significant.


  5. I found a lot of information here to create this actually best for all newbie here. Thank you for this information.
    facebook entrar iniciar sesion gratis - Sitio Oficial iniciado sesión en Facebook lengua española. facebook entrar rápido, facebook iniciar sesion en tu cuenta de entrar facebook

  6. One of the links you mention (http://www.paulirish.com/2010/the-protocol-relative-url/) has actually been updated to say the opposite: "Now that SSL is encouraged for everyone and doesn’t have performance concerns, this technique is now an anti-pattern. If the asset you need is available on SSL, then always use the https:// asset."

  7. Thanks for posting! Very useful.

  8. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.

    Pawn Shop

    Pawn Loans

    Pawn Shops

    Pawn Loan

    Pawn Shop near me

  9. Sabung Ayam Resmi 2018 klik di sini
    cheat games online

    dan dapatkan seputar sabung ayam hanya di sini www.ayamkari.co


  10. mytectra placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance.

  11. I like people sharing such information, it is very nice of them.


  12. Selenium is one of the most popular automated testing tool used to automate various types of applications. Selenium is a package of several testing tools designed in a way for to support and encourage automation testing of functional aspects of web-based applications and a wide range of browsers and platforms and for the same reason, it is referred to as a Suite.

    Selenium Interview Questions and Answers
    Javascript Interview Questions
    Human Resource (HR) Interview Questions


Thanks a lot for your valuable comments :)