/ Published in: HTML
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<!-- html sample -->
<ul>
</ul>
<script type="text/javascript">
//<![CDATA[
/* script to dynamically filter a list by name with a user search
#search is an input[text] where users can enter a name
Name in list and user input must to be in lowercase. This filter is case sensitive so we're going to lowercase user input before searching
We use the jQuery function 'contains()' directly in our selector to look for an occurence of the user input in the element.
--------------------------------------------------------------------*/
$("#search").bind("keyup", function(){
var name = $("#search").val();
name = name.toLowerCase();
$(".name-list").hide();
$(".name-list:contains('"+strToSearch+"')").show();
});
//]]>
</script>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                