Return to Snippet

Revision: 42113
at February 27, 2011 15:14 by FatFolderDesigner

Initial Code
function insert(){
    var name = $("input[name='insertvalue']").val();
        var toinsert = true;
        $("ol.thelist > li").each(function(){
            var item = $(this).html();
            if(name.toUpperCase() < item.toUpperCase()){
                    toinsert = false;

Initial URL

Initial Description
This function will insert items into an orders alphabetically (assuming it's already alphabetical). Initially design to make a smooth single page load/save feature that sotred everything in drop down lists, you guessed it, alphabetically. Can simply be modified to work in any sort of layout (ordered lists was just easier for the example)

Example at the link, you can post any questions there too.

Initial Title
Insert alphabetically with jQuery

Initial Tags
simple, jquery

Initial Language