Selecting Text in Input in FF and/or Safari (replacement for TypeAheadSelect)

P

Phrogz

Years ago I wrote a library[1] to turn normal <selects> into text
inputs that the user can type in, with various features. In those days,
I was working for an IE-centric company, so I didn't spend the effort
to make it cross browser. (Bad me!)

Now I need the functionality of that library, but I need it for FF or
Safari. Specifically, I want the type-ahead autocompletion feature of
that library. (Play with the 4th and 5th inputs on the documentation
page if you don't know what I mean.)

So, I have two choices:
1) Find out that someone already has a library like this available and
use that, or
2) Update my library to be cross-browser compatible.

So the questions:
1) Does anyone know of a library that allows you to specify a set of
values that an input may contain, such that as the user types, the best
match is completed in text and selected (so that typing overwrites the
value)? Ideally, this should be done without http requests. It must
allow the user to type in an arbitrary value (not one of the
pre-supplied values).

2) Can someone please point me to references for selecting a section of
text inside an <input> for Firefox (and, if available, Safari).
Cross-browser is preferable, but I'm happy to branch for IE and FF as
necessary.

Thanks in advance for any help.

[1] http://phrogz.net/tmp/TypeAheadSelect/typeaheadselect_docs.html
 
M

Martin Honnen

Phrogz said:
2) Can someone please point me to references for selecting a section of
text inside an <input> for Firefox (and, if available, Safari).
Cross-browser is preferable, but I'm happy to branch for IE and FF as
necessary.

Mozilla and Opera 8/9:
inputControl.selectionStart
inputControl.selectionEnd
to read out the start respectively end of the text selection in the
control and
inputControl.setSelectionRange(start, end)
to set a new selection
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top