Javascript 没有像onAutocomplete这样的事件侦听器。我很高兴你找到了解决问题的办法。谢谢分享链接。他们可能会帮助某些人。查看我的答案这并不适用于所有浏览器,但是,它适用于大多数未触发change事件的浏览器,因此您只需向change和input事件添加侦听
Javascript 没有像onAutocomplete这样的事件侦听器。我很高兴你找到了解决问题的办法。谢谢分享链接。他们可能会帮助某些人。查看我的答案这并不适用于所有浏览器,但是,它适用于大多数未触发change事件的浏览器,因此您只需向change和input事件添加侦听,javascript,jquery,html,autocomplete,Javascript,Jquery,Html,Autocomplete,没有像onAutocomplete这样的事件侦听器。我很高兴你找到了解决问题的办法。谢谢分享链接。他们可能会帮助某些人。查看我的答案这并不适用于所有浏览器,但是,它适用于大多数未触发change事件的浏览器,因此您只需向change和input事件添加侦听器$field.on('change input',changeFunction)我使用$input.on('keyup input change paste',callback)。效果很好。 <input name="emai
没有像onAutocomplete这样的事件侦听器。我很高兴你找到了解决问题的办法。谢谢分享链接。他们可能会帮助某些人。查看我的答案这并不适用于所有浏览器,但是,它适用于大多数未触发
change
事件的浏览器,因此您只需向change
和input
事件添加侦听器$field.on('change input',changeFunction)
我使用$input.on('keyup input change paste',callback)
。效果很好。
<input name="email" />
<div id="whatever"><whatever></div>
div {
float: right;
}
$("input").on('keyup change click', function () {
var v = $(this).val();
if (v) {
$("#whatever").text(v);
}
else {
$("#whatever").text('<whatever>');
}
});
monitorEvents($("input")[0]);
window.timeouts = new Array();
window.memo_values = new Array();
jQuery('#name').focus(function ()
{
var id = jQuery(this).attr('id');
window.timeouts[id] = setInterval('onChangeValue.call(document.getElementById("'+ id +'"), doSomething)', 500);
});
jQuery('#name').blur(function ()
{
var id = jQuery(this).attr('id');
onChangeValue.call(document.getElementById(id), doSomething);
clearInterval(window.timeouts[id]);
delete window.timeouts[id];
});
function onChangeValue(callback)
{
if (window.memo_values[this.id] != this.value)
{
window.memo_values[this.id] = this.value;
if (callback instanceof Function)
{
callback.call(this);
}
else
{
eval( callback );
}
}
}
function doSomething()
{
alert('got you! '+this.value);
}
$("input").on('blur keyup change click', function () {
$('html').bind('input', function() {
alert('test');
});
$input.on( 'focus', function(){
var intervalDuration = 1000, // ms
interval = setInterval( function(){
// do your tests here
// ..................
// when element loses focus, we stop checking:
if( ! $input.is( ':focus' ) ) clearInterval( interval );
}, intervalDuration );
} );
$(input).on('input', function() {
alert("Number selected ");
<input type="text" onInput="affiche(document.getElementById('something').text)" name="Somthing" />
let myFun = ()=>{ ..do Something };
input.addEventListener('change', myFun );
//fallback in case change is not fired on autocomplete
let _k = null;
input.addEventListener( 'keydown', (e)=>_k=e.type );
input.addEventListener( 'keyup', (e)=>_k=e.type );
input.addEventListener( 'input', (e)=>{ if(_k === 'keyup') myFun();})