jeudi 8 septembre 2016

Match the checkbox text and show only those based on user input in search field

Have a search box and many checkbox elements.

Once user types any text in serch box it should search the checkbox text and show only those checkbox others should be hidden

Here is the code

<input type="text" value="" name="searchColumn" id="searchColumn"/>

<input type="checkbox" value="column1">column1
<input type="checkbox" value="column2">column2
<input type="checkbox" value="column3">column3
<input type="checkbox" value="column4">column4

Now if user types text "col" in search box all checkbox should appear as "col" string is present in all checkbox

if user types text "abc" in search box no checkbox should appear as "abc" is not present in any checkboxes

if user types text "column1" in search box only one checkbox should appear as "column1" matches with only one checkbox

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire