title
my name
description paragraph
paragraph of text
$('#product'); // ID
document.getElementbyId();
$('p'); // Tag
document.getElementsByTagname();
$('.productname'); // Class
document.getElementsByClassName();
$('#linkbox a[href^="http"]'); // Attribute
$('#linkbox').find('a[href^="http"]');
$('h3:first-child'); // pseudo :nth-child(1)
$('#leftnav').find('h3:first-child');
================
$("#product").addClass("available");
$("#product").css("backgroundColor", "#fff");
$("#product").width(300);
var currentProduct = $("#product");
currentProduct.addClass("available");
currentProduct.css("backgroundColor", "#fff");
currentProduct.width(300);
var currentProduct = $("#product");
currentProduct.addClass("available").css("backgroundColor", "#fff").width(300);
================
var productItems = data.products, itemStr = '';
$.each(productItems, function(index,item) {
itemStr += '
'+item+'';
});
$('#sidebar').find('ul').append(itemStr);
================
Use jQuery script tags at the bottom of the page
Use a CDN and add redundancy
Use .ready() method for your code
Use selectors that map to native browser methods
Use chaining
Cache your selectors for use multiple times
Try to keep selectors and DOM manipulation out of loops or .each() methods
================