For once I need to use Prototype instead of jQuery, which I’m not very comfortable with.
Can someone help me convert this following script:
var output={};
$('ul li').each(function(i,v){
var l=$(this).text().substring(0,1).toUpperCase();
if(typeof(output[l])=="undefined") output[l]=[];
output[l].push($(this).text());
});
$('ul').empty();
for(var i in output){
$('ul').append('<li><p>'+i+'</p></li>');
for(var j in output[i]){
$('ul').append('<li>'+output[i][j]+'</li>');
}
}
Full source: http://jsfiddle.net/flxfxp/3LwH8/7/
Many thanks!
Tested with latest Prototype