type ahead textbox to dropdown


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function PartialClient() {
  2. //Do stuff...
  3. var partialName = document.Form2.txtClientPartial.value;
  4. var c = document.Form2.ddlVendors;
  5. if (partialName != "") {
  6. for (var i = 0; i < c.length; i++) {
  7. if (c[i].text.toUpperCase().indexOf(partialName.toUpperCase()) == 0) {
  8. //document.Form2.attrib_1.selectedIndex = i;
  9. document.Form2.ddlVendors.selectedIndex = i;
  10. break;
  11. }
  12. else if (c[i].value == partialName.toUpperCase()){
  13. document.Form2.ddlVendors.selectedIndex = i;
  14. break;
  15. }
  16.  
  17. }
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.