onKeyUp when selecting from autocomplete

J

Jason C

I'm changing a DIV area as the site visitor types into an input field, likethis:

<input type="text" name="title" size="20"
onKeyUp="
document.getElementById('title').innerHTML =
document.admanager.title.value
">

This works fine if they are actually typing, but the problem I'm having is if they're typing and select something from their browser's autocomplete. If they select it using an arrow and carriage return, then it still works, but if they select with their mouse then it doesn't.

Is there an event that runs on key press OR mouse selection, or am I going to have to duplicate it like this? (untested):

<input type="text" name="title" size="20"
onKeyUp="
document.getElementById('title').innerHTML =
document.admanager.title.value
"

onChange="
document.getElementById('title').innerHTML =
document.admanager.title.value
"
 
A

Antony Scriven

I'm changing a DIV area as the site visitor types into an
input field, like this:

<input type="text" name="title" size="20"
onKeyUp="
document.getElementById('title').innerHTML =
document.admanager.title.value
">

This works fine if they are actually typing, but the
problem I'm having is if they're typing and select
something from their browser's autocomplete. If they
select it using an arrow and carriage return, then it
still works, but if they select with their mouse then it
doesn't.

Is there an event that runs on key press OR mouse
selection, or am I going to have to duplicate it like
this? (untested):

<input type="text" name="title" size="20"
onKeyUp="
document.getElementById('title').innerHTML =
document.admanager.title.value
"

onChange="
document.getElementById('title').innerHTML =
document.admanager.title.value
"

'(untested)' Why? --Antony
 
D

dhtml

I'm changing a DIV area as the site visitor types into an input field, like this:

<input type="text" name="title" size="20"
  onKeyUp="
    document.getElementById('title').innerHTML =
    document.admanager.title.value
">

This works fine if they are actually typing, but the problem I'm having is if they're typing and select something from their browser's autocomplete.If they select it using an arrow and carriage return, then it still works,but if they select with their mouse then it doesn't.
There are several problems with your untested code.
Is there an event that runs on key press OR mouse selection,

"OR", so capitalized, signifies disjunction. You probably meant "and".
Mouse selection? What is wrong with selecting by other input devices?
On laptop, I select text with the keyboard, e.g. on Mac, shift + left
arrow key selects 1 char left of caret position.

or am I going to have to duplicate it like this? (untested):
[...]

Somebody who likes ads may help you try to figure out what you wanted
to ask and how to do that.
 

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

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top