0

After several failed attempts using ExtJS I have now decided to use javascript.The requirement is to assist a combo box in select tag.If the list contains aa,aaa,aab,abc,bac,cba then if I type 'ab' continuously then it will select 'abc'.Whereas if I type 'a' time gap and then 'b' it will select 'bac' instead of 'abc'. Can anyone tell me whether its possible in js to get what I want?If not js is it possible in Jquery.Please ignore the previous duplicates.

1 Answer 1

0

It's possible. You're going to want to track when you your keypress events fire. Capture the time the "a" was entered, and then the time the second key was entered. If it's above a threshold, you want the second letter to be first, and the first letter to come second. If it's below your threshold, you want the first letter first, and the second letter second.

6
  • Yes exactly.How is it possible.Can you elaborate
    – Harish
    Commented Aug 4, 2009 at 10:17
  • Do you have onkeyup for Select tag?
    – Harish
    Commented Aug 4, 2009 at 10:43
  • You will need to bind this to a textbox, and use the value of the textbox to filter the select options.
    – Sampson
    Commented Aug 4, 2009 at 11:05
  • bind to a textbox? how is that possible?
    – Harish
    Commented Aug 4, 2009 at 11:14
  • $("textbox.myTextbox").bind("keyup", function(event){ /* code here / }); Within your "/ code here */" portion is where you will filter the results, using the select > option's as your datasource.
    – Sampson
    Commented Aug 4, 2009 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.