jQuery

Events still working with dynamically added elements

$(".test").live("click", function(){
    alert('yes');
});

Source: http://www.ibm.com/developerworks/web/library/wa-aj-advjquery2/index.html

Disable right-click on image or div

$('.no_download').bind('contextmenu', function(e){
	e.preventDefault();
});

Note: for an image which is also a link, the class has to be applied to the image (not to the link):

<a href="...">
    <img class="no_download" src="..." />
</a>

Source: Cats Who Code: 8 awesome JQuery tips and tricks

Pop-up links

Javascript

$("a[rel='external']").click(function(){
    this.target = "_blank";
});

HTML

<a rel="external" href="http://google.com">
    Google
</a>

hide() buggy in IE6

Example: element after a div hidden dynamically by hide() is stretched. Solution: use toggle().

Fun

Highlight every other row (zebra effect)

$(this).find("tbody > tr").filter(":odd").addClass("highlight");

Reference

 

Feedback