Never used the plugin, but doing the sort you want is fairly simple: $('#refmenu').click(function(){ var sorted = $.makeArray($('#list>li')).sort(function(a,b){ return ($(a).children('a').attr('title') < $(b).children('a').attr ('title')) ? -1 : 1; }); $('#list').html(sorted); });
HTH On Oct 12, 5:55 am, tfat <tony.fatou...@gmail.com> wrote: > Hi, > > I have the following DOM structure (unordered list), that I would like > to sort on the a href tag name using jQuery – specifically the > TinySort plug-inhttp://plugins.jquery.com/project/TinySort > > Structure is as follows: > > <div id="refmenu"> > <ul id="list"> > <li><a title="Google" href="....">Google</a></li> > <li><a title="Apple" href="....">Apple</a></li> > <li><a title="IBM" href="....">IBM</a></li> > <li><a title="Yahoo!" href="....">Yahoo!</a></li> > <li><a title="Hotmail" href="....">Hotmail</a></li> > </ul> > </div> > > I have tried the following but to no avail, i.e.: > $("div#refmenu>ul#list>li").tsort("a[title]",{orderby:"title"}); > > Based on this, I am obviously trying to sort on the title attribute. > > Any help would be great. > > Other questions, do I need to make this call within the document.ready > () or can I just perform this call within a normal javascript > function? > > Thanks.