尝试一堆没有可行结果的解决方案.我有代码获取跨度的值并为LI创建一个ID.然后我想根据LI的ID对这些LI的DESCENDING进行排序.救命?谢谢!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul id="dumb">
<li>cello<span>2987</span></li>
<li>zello<span>1723</span></li>
<li>aello<span>3476</span></li>
</ul>
<script type='text/javascript' src='JQUERY INCLUDE'></script>
<script type="text/javascript">
$(document).ready(function() {
$('ul li span').each(function(){
var pubValue = $(this).html();
$(this).parent().attr('id', pubValue);
});
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)