i have text field empty, when click in it has suggestions previous inputs.
which javascript event fired if choose 1 of them mouse?
i'm using jquery 1.6.2 binding listeners:
view.textregistrations.bind("blur change keyup", function(event) { //do });
the oninput event triggered.
try:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>title</title> </head> <body> <form method="get" id="" action=""> <input type="text" name="name" oninput="alert('oninput')"/> <input type="submit" value="done"/> </form> </body> </html> the diffrence between oninput,onpropertychange,onchange:
onchange fired when
a)the property changed user interface
b)and element lost focus
onpropertychange fires when property change. ie only
oninput
oninput w3c version of onpropertychange . ie9 begin surport event .
oninput fired when element value changes.
so if want compacity in browsers
ie<9 use onpropertychange
ie>9 , other broweser use oninput
if use jquery , can bind 2 event share same hander
$(function($) { //the same handler function oninput(e){ //do sth } $("#ipt").on("input", function(e){ console.log("trigger oninput"); oninput(e); }) $("#ipt").on("propertychange", function(e) { console.log("trigger propertychange"); oninput(e); }) })
Comments
Post a Comment