Last active
December 19, 2018 04:13
-
-
Save Joseph7451797/61db7eb8b42f3fbf9dc8 to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/xejino
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="https://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id="ccc">clicktoserial</div> | |
<div id="ddd">clicktorandom</div> | |
<ul id="cat"> | |
<li id="3">Text 3</li> | |
<li id="11">Text 11</li> | |
<li id="1">Text 1</li> | |
<li id="2">Text 2</li> | |
<li id="6">Text 6</li> | |
<li id="4">Text 4</li> | |
<li id="5">Text 5</li> | |
<li id="7">Text 7</li> | |
<li id="12">Text 12</li> | |
<li id="10">Text 10</li> | |
<li id="8">Text 8</li> | |
<li id="9">Text 9</li> | |
</ul> | |
<script id="jsbin-javascript"> | |
$("#ccc").click(function() { | |
$("#cat li").sort(function (a, b) { | |
return parseInt(a.id) - parseInt(b.id); | |
}).each(function(){ | |
var elem = $(this); | |
elem.remove(); | |
$(elem).appendTo("#cat"); | |
}); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">$("#ccc").click(function() { | |
$("#cat li").sort(function (a, b) { | |
return parseInt(a.id) - parseInt(b.id); | |
}).each(function(){ | |
var elem = $(this); | |
elem.remove(); | |
$(elem).appendTo("#cat"); | |
}); | |
}); | |
</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
$("#ccc").click(function() { | |
$("#cat li").sort(function (a, b) { | |
return parseInt(a.id) - parseInt(b.id); | |
}).each(function(){ | |
var elem = $(this); | |
elem.remove(); | |
$(elem).appendTo("#cat"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment