Skip to main content

Bug Tracker

Side navigation

Ticket #4191: jq_4191_demo.html
File jq_4191_demo.html, 0.7 KB (added by mikecapp, June 01, 2009 05:17PM UTC)

Reduced demonstration page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
		<title>BUG: data lost on clone</title>
		<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
	</head>
	<body>
		<p>Click buttons to see attached data:</p>
		<script type="text/javascript">
			var jq = $("<button>Original</button>")
				.data("blah", 123)
				.appendTo("body")
				.click(function() { alert("blah = " + $(this).data("blah")); });
			
			jq.clone(true).text("Clone").appendTo("body");
		</script>
	</body>
</html>

Download in other formats:

Original Format