Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What are JavaScript Best practices To Apply to jQuery And JavaScript code?

¡list of things to do, and not to do, when developing JavaScript and jQuery!

user-image
Question added by Mahmoud Manaa , Network Engineer , Zain - Kuwait
Date Posted: 2013/11/04
Clodelio Delfino
by Clodelio Delfino , Managing Consultant , Startup Company

Just a random JS tips...

1. Optimize selectors for Sizzle’s ‘right to left’ model

$('.class span.class2') - OK

$('#id div.class') - Recommended

 

2. Don’t load code that isn’t needed or until it is needed

3. Load the framework from CDN or better using Google Code

4. Use lazy loading especially from image/s

5. When emptying nodes: always prefer removeNode() over innerHTML = ''

6. Optimising a selectors

$('div.content') Slower

$('#container div.content') Slow

$('#container').find('div.content') Fast

Jonathan de Flaugergues
by Jonathan de Flaugergues , software engineer , Abbeal

The best practice is to not use jQuery.

This library is now useless and deprecated with the last framework as React and Angular.

Maisnam Raju Singh
by Maisnam Raju Singh , web developer , Comnicate

Avoid global namespacing

minification and obfuscation 

 

hello i am hassan this is my new website to learn english,french and arabic languages,grammar vocubulary ....etc ; you can also click beside the phrase to listen to the way the phrase is pronounced by clicking "click ".http://www.nbc01.com/May-Can.phpif you want to compare GDP of many countries you can click this link http://www.nbc01.com/Calculate-GDP.phphttp://www.nbc01.com/Calculate-your-GDP-PER-CAPITA.phpif you want to count the number of occurrence of a word in a text Coran ....etc click this linkhttp://www.nbc01.com/Words-occurrence.phphttp://www.nbc01.com/Words-occurrence.phpAll my regards

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.