5

Gist

Which event gets triggered when we select from a dropdown which is populated from the cache ( such as usernames and other form values ) in a <input type="text"> .

Detailed

In a form, we can login with multiple username say A,B,ABC . And the browser caches all these values ( w.r.t password remember ). So,if we try to login with A - a drop down pops up giving multiple option say A , ABC -- which event gets triggered once we select any of the options provided.

oninput, onchange, onblur -- none of which seems to get triggered if we select from browser provided drop down.

Help, Beginner

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Vivek Chandra
  • 4,240
  • 9
  • 33
  • 38

3 Answers3

0

You can use these events with select. Cache has nothing to do with the drop down.

What you need is depending on your use.

Generally onchange is used to get the value or call a function when the value changes.

onblur would trigger a function when the drop down losses focus. eg, when you use tab or other methods.

Umesh Moghariya
  • 3,063
  • 6
  • 21
  • 23
  • i've clearly mentioned its not `select` on which i'm working on!!.. its on `input textbox`.See the question and answer!! – Vivek Chandra Apr 04 '12 at 10:36
  • I got the `input textbox` but my answer according to your question says Which event gets triggered when `we` select from a dropdown ..... in a . So my answers says it depends on what u want to use.. Am i missing something? – Umesh Moghariya Apr 04 '12 at 10:52
  • i know what `onchange` and `onblur` does.. and not using `select` tag.. its the normal drop down that comes on textbox for usernames ( gmail/facebook/twitter and many other major sites - their usernames will be cached by the browser ).. that's what i want,not the select tag!! – Vivek Chandra Apr 04 '12 at 11:49
0

This question is answered here: On input change event?

In modern browsers use the input event. This event will fire when the user is typing into a text field, pasting, undoing, basically anytime the value changed from one value to another.

Midwire
  • 1,090
  • 8
  • 25
  • Have you tested it?, has you seen it work?. The question is "browser fed data addition - event". – Vivek Chandra Feb 09 '16 at 13:51
  • Indeed, I have tested it. I never post an answer without first testing it. Like you, I was looking for this same solution. First stumbled on your question and saw that the previous answer did not work. Then found the one that I posted above. – Midwire Feb 09 '16 at 15:57
0

easily use select event

example:

$('#test').select(function(){ alert('data changed'); });