Our project does not require the use of any javascript libraries such as jQuery, Dojo, or Prototype so finding a solution may be more challenging. I am looking for detailed answers to this question explaining how it can be accomplished. As many of you may be aware, an asp.net checkboxlist generates markup in Flow
repeatLayout.
<span>
<checkbox><label></br>
<checkbox><label></br>
<checkbox><label></br>
</span>
I have omitted the closing tags for simplicity. There is a textbox for searching through this list of checkboxes. Now, here is my question:
How can I filter the checkboxlist when a user types a search term in the textbox and hide the unmatched checkboxes and labels?
Additionally, I have some related questions that I would like answers to:
Is there any standalone script available for this purpose?
Are there any patterns, articles, or posts explaining issues to consider while implementing search functionality? For example, something like
onkeydown do's and don'ts
.My current idea involves having a cached collection of label tags' `innerHTML`, then looping through each tag to check for the search term. When found, hide all others but only show matching ones. However, I am concerned about performance implications with a long list. Is there a better approach that doesn't involve looping on every keypress?
Your suggestions, solutions, scripts, and answers are greatly appreciated.