Skip to content

Instantly share code, notes, and snippets.

@tkaemming
Created November 23, 2010 03:14
Show Gist options
  • Save tkaemming/711171 to your computer and use it in GitHub Desktop.
Save tkaemming/711171 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function (event) {
var elem = $('<div>element <a href="#">inner element</a></div>');
elem.delegate('a', 'click', function (event) {
alert('clicked');
});
$('body').append(elem);
window.setTimeout(function () {
var clone = $('div').clone(true);
$('div').replaceWith(clone);
alert('dom updated');
}, 2000);
});
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment