473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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

Years ago I wrote a library[1] to turn normal <selectsinto 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 <inputfor 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/TypeAheadSelec...lect_docs.html

Oct 31 '06 #1
2 1606
Phrogz wrote:
2) Can someone please point me to references for selecting a section of
text inside an <inputfor 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
--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 31 '06 #2

Martin Honnen wrote:
Phrogz wrote:
2) Can someone please point me to references for selecting a section of
text inside an <inputfor 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
--

Martin Honnen
http://JavaScript.FAQTs.com/
See also scriptaculous Autocompleter.Local

http://wiki.script.aculo.us/scriptac...ompleter.Local

--Dean

Nov 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Duderonomoy | last post by:
Hello, I am querying the JavaScript community to learn if others are having problems with Safari and JavaScript arrays: myImages = ; then referenced like this:
7
by: Razzbar | last post by:
I have a textarea and some buttons. The buttons apply functions to the text the user selects, i.e. the good old "wrap with a tag" thing we all have seen in 100 different editors. Trouble is,...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
2
by: Mark Szlazak | last post by:
The following code fails in Firefox to get at selected text in the right-side textarea. Any help would be appreciated. <html> <head> <script> var agt = navigator.userAgent.toLowerCase();...
5
by: D | last post by:
hi there , i want to do something fairly simple (well it was simple in PERL) using the replace function of Regex... but i cannot find the docs to help me on it... i want to use a regex to find a...
1
by: mitch | last post by:
I'm trying to clear the currently selected text on a page. This line works from IE: document.selection.empty(); and this one from Firefox: window.getSelection().removeAllRanges(); ...
4
by: drew197 | last post by:
I am a newbie. I am editing someone elses code to make it compatible with Firefox and Safari. In IE, when you click on the proper link, a block of text is shown in a nice paragraph form. But, in...
4
by: yavannadil | last post by:
Hello! I use the following to translate button names in Google Maps: G_NORMAL_MAP.getName = function(short) { if(short) {return "Karta"} return "Karta"; } It works (tested) with Firefox...
4
by: Paul J. Lucas | last post by:
I have a simple form that contains an INPUT element that has an initial value. <form name="Form"> <input name="Number" type="text" value="Hello"> </form> When the form loads, I want all of...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.