Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #7580 > unrolled thread

onKeyUp when selecting from autocomplete

Started byJason C <jwcarlton@gmail.com>
First post2011-10-19 18:35 -0700
Last post2011-10-20 21:23 -0700
Articles 3 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  onKeyUp when selecting from autocomplete Jason C <jwcarlton@gmail.com> - 2011-10-19 18:35 -0700
    Re: onKeyUp when selecting from autocomplete Antony Scriven <adscriven@gmail.com> - 2011-10-20 16:13 -0700
    Re: onKeyUp when selecting from autocomplete dhtml <dhtmlkitchen@gmail.com> - 2011-10-20 21:23 -0700

#7580 — onKeyUp when selecting from autocomplete

FromJason C <jwcarlton@gmail.com>
Date2011-10-19 18:35 -0700
SubjectonKeyUp when selecting from autocomplete
Message-ID<21118012.96.1319074503372.JavaMail.geo-discussion-forums@yqp37>
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
  "
>

[toc] | [next] | [standalone]


#7592

FromAntony Scriven <adscriven@gmail.com>
Date2011-10-20 16:13 -0700
Message-ID<70f0467f-33d2-43dd-bf40-ed45cf2d8bbe@gk10g2000vbb.googlegroups.com>
In reply to#7580
On Oct 20, 2:35 am, Jason C wrote:

 > 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

[toc] | [prev] | [next] | [standalone]


#7594

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-10-20 21:23 -0700
Message-ID<b7cb7408-d702-471c-b376-2a534bead0e0@k13g2000prg.googlegroups.com>
In reply to#7580
On Oct 19, 6:35 pm, Jason C <jwcarl...@gmail.com> wrote:
> 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.
--
Garrett

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web