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

  13. Guaranteed #1 Search Engine Ranking Supreme Free Viral Traffic Join Now Get Millions Of Hits Free To Your Site/Blog!

    PornKings Adult Shopping Backlinks-Shopping Mega Store Legendary Stars As Stormy Daniels,Shawna Edwards,Jenna Jamison-New Adult Stars Movies,Adult Toys,Enhancers,Merchandise-More !

    Hits Express Rotator System Do You Need Visitors to Your Website or Affiliate Program? If your looking to gain more visitors to your website Hits Express is your answer. With our program your site is being shown to people all over the world 24/7 365 days a year!

    PAYDIR Free For All Forum Portal Search Engine Crawled Network PR10 Ranking Information Forum XXX!

    FreeLinkExchanges Be Seen In 12 Nations 312 Sites Over 30 Millions Viewers Monthly Buy Featured Link Now With 150 Search Engines Crawling The Network!

    How do I get guaranteed traffic? When someone signs up from your site, they must first click on your classified ad which will open a new window leading to your main website. They will have to wait a few seconds for the code to appear on a separate frame at the top of the screen reach millions free now!

    Blast Your Ad to Over 23,000 Opt-in Prospects at ShowMyLinks Submit Your Solo Email Ad to All Showmylinks Members GET YOUR TEXT LINK ADs LISTED 100% FREE FOR LIFE PLUS EARN MONEY TO YOUR PAYPAL!!

    Adult Store Empires Backlinks Resources Search Engine XXX!

    GET YOUR OWN MONEY-MAKING AD BOARD -- Integrating Text ad, Banner Ad and Email Ad into one Portal Make Money Fast With Your Paypal Reach Million Dollars In A Year Fast !

    Full Length Homemade Videos Watch real people's private home sex videos. Forget about those shitty 1-2 minute clips, these are all high quality full length videos! 40+ Bonus Sites You will also get full access to the entire reelpass network of sites which features over 40+ awesome movie sites, 1000's of movies and pictures to download! Download, Burn & Share Not only do you get to watch all our movies, you can also download every single one and save it forever, burn them to dvd or share with friends!!


  14. NICE for giving a chance to share ideas for your comuty i really thanks for that great post.


  15. NICE for giving a chance to share ideas for your comuty i really thanks for that great post.


  16. Very enjoyable to visit this blog and find something exciting and amazing.
    visit our web

  17. thank you for posting.
    It was very useful.
    keep sharing.
    best java training in bangalore


Thanks a lot for your valuable comments :)