<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){
var div = document.querySelector('#wrap'),
para = document.querySelectorAll('#wrap p');
var paraArr = [].slice.call(para).sort(function (a, b) {
return a.textContent > b.textContent ? 1 : -1;
});
paraArr.forEach(function (p) {
div.appendChild(p);
});
}
</script>
</head>
<body>
<div id="wrap">
<p>C</p>
<p>B</p>
<p>A</p>
</div>
</body>
</html>