Skip to content

madeindjs/select_option_filters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Select Option Filter

javascript filters for select html tag without Jquery dependencies.

inspired from this Stackoverflow question

Usage

Simple search

Add simply an input tag before to lock all non-match value in the section tag

<select id="combobox">
	<option value="C++">C++</option>
	<option value="JavaScript">JavaScript</option>
	<option value="PHP">PHP</option>
	<option value="Python">Python</option>
	<option value="Ruby">Ruby</option>
</select>

<script src="selectOptionFilter.js"></script>
<script type="text/javascript">
		add_filter("combobox");
</script>

Two section search

Extract the first word of all option to group them into a primary section. The second section show all possibles choices.

<select id="combobox">
	<option value="C++">C++</option>
	<option value="JavaScript">JavaScript</option>
	<option value="PHP">PHP</option>
	<option value="Python">Python</option>
	<option value="Ruby">Ruby</option>
</select>

<script src="selectOptionFilter.js"></script>
<script type="text/javascript">
	add_first_word_filter("fw_combobox", function(){
		console.log('value applied');
	});
</script>

Author

[Rousseau Alexandre][madeindjs]

License

MIT [madeindjs]: https://github.com/madeindjs/

About

Pure Javascript filters for select html tag without Jquery dependencies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published