Difference between 'bind' and 'live' methods.
by lucasprus
HTML
<button>Clone all p elements, and append them to the body element</button>
<p>This is a paragraph.</p><p>This is a paragraph.</p><p>This is a paragraph.</p>
JavaScript
$(function() {
$("button").click(function() {
$("p").clone().appendTo("body");
//$("p").clone(true).appendTo("body");
});
//$("p").bind("mouseenter", function() {
$("p").live("mouseenter", function() {
$(this).css("background-color", "yellow");
});
//$("p").bind("mouseleave", function() {
$("p").live("mouseleave", function() {
$(this).css("background-color", "");
});
});