I have a text box for search a listbox control. User wil enter text in textbox and listbox that contain rows of Project name will be filtered by the matching search string.
Can anyone provide Jquery code for this search?
I have a text box for search a listbox control. User wil enter text in textbox and listbox that contain rows of Project name will be filtered by the matching search string.
Can anyone provide Jquery code for this search?
I'm going to give you some hints and see how you get on
You're going to need to bind an event handler to the text input, for a particular event that happens when the value of the input changes.
Inside that event handler, you'll need to find all the elements of the listbox control (remember that you will need to know the HTML generated and sent to the client for the control) and check the text that each one contains.
If the value in the text input is found in the text of a particular list item, then that item can remain in the DOM. If it is not found, remove/hide that item.
Have a think about how you're going to reset the list items in the listbox when a new search is started or when the value in the text input is changed. You may want to initially store all the list items in JavaScript array, so that you can use the items in the array to repopulate the listbox when necessary.