davidolson Posted September 12, 2014 Share Posted September 12, 2014 <script type="text/javascript"> function listBoxSearch(){ var input = document.getElementById('searchBox'), output = document.getElementById('listBoxF'); if(input.value != ''){ for (var i = 0; i < output.options.length; i++){ if(output.options[i].text.substring(0, input.value.length).toUpperCase() == input.value.toUpperCase()){ output.options[output.options.length] = new Option(output.options[i].innerHTML, output.options[i].text); } } if (output.options.length == 1) { output.selectedIndex = 0; } } } </script> It dosen`t work. It should work like this[DEMO in attached filed] listbox_with_keybord_search.htm Quote Link to comment https://forums.phpfreaks.com/topic/291019-listbox-search-function-help/ Share on other sites More sharing options...
gizmola Posted September 12, 2014 Share Posted September 12, 2014 Hi David, We need more precision from you in describing your question. "It doesn't work" doesn't tell us enough. What specifically have you tried? What sort of debugging have you attempted? How did you determine it isn't working, and have you narrowed down the problem in any way? There are some very important tools for figuring out javascript problems, that are available in the browsers. I tend to use Firefox with firebug because that's what I know the best, but there are similar tools for chrome and IE. What are you using? There is also the well known testbed site http://jsfiddle.net that you can use to test and share your html/javascript coding iterations. Quote Link to comment https://forums.phpfreaks.com/topic/291019-listbox-search-function-help/#findComment-1490870 Share on other sites More sharing options...
davidolson Posted September 12, 2014 Author Share Posted September 12, 2014 my browser crash when i try to search items Quote Link to comment https://forums.phpfreaks.com/topic/291019-listbox-search-function-help/#findComment-1490874 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.