简体   繁体   中英

Jquery and IE10

I have three input fields, input1, input2 and input3.

When the value of input1 changes, input2 is set accordingly:

$('input[name=input1]').change(function () {
        console.debug("input1");
    $('input[name=input2]').val($(this).val());
    $('input[name=input3]').prop("disabled", true);
});


$('input[name=input2]').change(function () {
    console.debug("input2");

    ...
});

It works, but not on IE10. It doens't print on the console "input1" and "input2" and it doesn't change the input2 value.

EDIT

The problem seems to be also in IE<10

It seems to work if I use on with keyup .

But what if the user uses the mouse to select a cached value?

mouseenter has a strange effect.

为什么不使用'console.log'而不是'console.debug'来检查IE是否存在问题呢?

If you use the latest jQuery you could try to bind an event listener like so

$(document).on('change','#input1',changeFunction) 

older version you might use

$('#input1').on('change',changeFunction)

and then use the changeFunction(event) to do whatever

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM