Trying a bunch of solutions with no workable results. I have code that takes the value of the span and creates an ID for the LI. I then want to sort these LI's DESCENDING based on the LI's ID. Help? Thanks!
<!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>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…