Created
August 21, 2014 06:41
-
-
Save yardfarmer/6f518501dad149be8936 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/livoq/2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-git2.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div> | |
<ul> | |
<li class='a'>a</li> | |
<li>b</li> | |
<li>c</li> | |
<li>d</li> | |
</ul> | |
</div> | |
<script id="jsbin-javascript"> | |
$('div ul li:first').data('class','hightlight'); | |
b = $('.a').data(); | |
//var c = $('ul').append($('.a').clone()); // 不会带数据 | |
var c = $('ul').append($('.a').clone(true)); // 会带数据 | |
console.log(b,$('div ul li:last').data()); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('div ul li:first').data('class','hightlight'); | |
b = $('.a').data(); | |
//var c = $('ul').append($('.a').clone()); // 不会带数据 | |
var c = $('ul').append($('.a').clone(true)); // 会带数据 | |
console.log(b,$('div ul li:last').data()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment