469,315 Members | 1,573 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,315 developers. It's quick & easy.

highlighting or changing background of some text in input box

Hello,
I am trying to add an autocomplete functionality for tags, so I want
to just have the following capability:
If I type
ger

then the word my application matches that to is
german

So, I want 'ger' to look normal, and 'man' to be highlighted.

In an input box I can't use html tags, but I believe there is a
javascript function that will allow me to highlight just the part I
want highlighted.

How would I do this?

Thanx.

Jul 25 '07 #1
2 1329
On Jul 25, 9:55 am, James Black <planiturth...@gmail.comwrote:
Hello,
I am trying to add an autocomplete functionality for tags, so I want
to just have the following capability:
If I type
ger

then the word my application matches that to is
german

So, I want 'ger' to look normal, and 'man' to be highlighted.
You mean you want "man" to be selected.
>
In an input box I can't use html tags, but I believe there is a
javascript function that will allow me to highlight just the part I
want highlighted.
Look into createTextRange for IE and setSelectionRange for others.
The former creates a range object, which can then be manipulated to do
what you want. The latter can do it with one call. Make sure you
detect these methods before calling.

Jul 25 '07 #2
On Jul 25, 12:56 pm, David Mark <dmark.cins...@gmail.comwrote:
So, I want 'ger' to look normal, and 'man' to be highlighted.

You mean you want "man" to be selected.
I was hoping to be able to arbitrarily change the background for the
part I want selected, but that appears to not be possible.
Look into createTextRange for IE and setSelectionRange for others.
The former creates a range object, which can then be manipulated to do
what you want. The latter can do it with one call. Make sure you
detect these methods before calling.
Thank you very much.

Jul 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by rossum | last post: by
5 posts views Thread by Adelson Anton | last post: by
4 posts views Thread by Bob hotmail.com> | last post: by
reply views Thread by Brian Scott | last post: by
7 posts views Thread by JohnSmith90 | last post: by
5 posts views Thread by Xerxes | last post: by
2 posts views Thread by russiandevil | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.