Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
var maxWidth = 0;
//total amount of li-tags
var maxli = $('ul li').length-1;
$('ul li').each(
    function(index){
            //wrap li-content width inline element like <span>
        $(this).wrapInner( "<span></span>");
            //get max-width of spans
        if( $(this).children('span').width() > maxWidth ){
            maxWidth = $(this).children('span').width();
        }
        //complete
        if(index == maxli){
                    //set width of parent ul-tag to max-size of the longest li-tag
            $(this).parent('ul').width(maxWidth);
        }   
    }
);  
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers