Some quick source code:

HTML:
<span>All</span> <span>B</span> ... <span>W</span>
<select size="6">
<option>Bellucci, Monica</option>
<option>Bernhardt, Daniel</option>
<option>Chou, Collin</option>
<option>Fishburne, Laurence</option>
<option>Gaye, Nona</option>
<option>Hulme, Lachy</option>
<option>Lees, Nathaniel</option>
<option>Lennix, Harry J.</option>
<option>McColm, Matt</option>
<option>Moss, Carrie-Anne</option>
<option>O'Reilly, Genevieve</option>
<option>Perrineau, Harold Jr.</option>
<option>Pinkett Smith, Jada</option>
<option>Rayment, Adrian</option>
<option>Rayment, Neil</option>
<option>Reeves, Keanu</option>
<option>Spence, Bruce</option>
<option>Weaving, Hugo</option>
<option>Wilson, Lambert</option>
<option>Wong, Anthony</option>
</select>

JS:
$(document).ready(function(){
        //cache the original select and options
        var selList = $('select'), opts = selList.find('option');

        //filters by first letter of last name as option text
        function filterList(ltr){
                selList.empty();
                if(ltr==='All'){
                        selList.append(opts);
                        return;
                }
                var re = new RegExp("^"+ltr,"i"), newopts = '';
                $.each($.grep(opts,function(o,i){return re.test($(o).text
());}),function(){
                        selList.append(this);
                });
        }

        $('span').click(function(){
                filterList( $(this).text() );
        });
});

Maybe that will give you someplace to start.

On Jun 26, 8:29 am, shaded <dar...@eztransition.com> wrote:
> here is a non jquery solution to what i'm looking for.
>
> http://www.barelyfitz.com/projects/filterlist/index.php/1
>
> Does anyone know of jquery plugin to do the same or maybe if its easy,
> some quick source code?
>
> thanks

Reply via email to