Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/419.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript MSIE在.mouseup()事件之前无法识别所选项目的更新_Javascript_Jquery_Internet Explorer - Fatal编程技术网

Javascript MSIE在.mouseup()事件之前无法识别所选项目的更新

Javascript MSIE在.mouseup()事件之前无法识别所选项目的更新,javascript,jquery,internet-explorer,Javascript,Jquery,Internet Explorer,我有一个带有几个列表的设置,允许您在上执行各种功能,具体取决于所选的功能。最初,我在上有一个.change()事件处理程序,它将首先在列表中找到所选元素,并相应地更新控件按钮的状态。(对于列表中的某些项目,某些功能应不可用) 然而,MSIE中.change()的奇怪行为我尝试了change(),它在IE/Mozilla/Chrome中工作 var selectList = $("#select"); var getCurrent = function(e) { currentSelec

我有一个带有几个
列表的设置,允许您在
上执行各种功能,具体取决于所选的功能。最初,我在
上有一个.change()事件处理程序,它将首先在列表中找到所选元素,并相应地更新控件按钮的状态。(对于列表中的某些项目,某些功能应不可用)

然而,MSIE中.change()的奇怪行为我尝试了change(),它在IE/Mozilla/Chrome中工作

var selectList = $("#select");

var getCurrent = function(e) {
    currentSelections = $("#select :selected");
 vals = [];
    for (var x = 0; x < currentSelections.length; x += 1) {
        vals.push($(currentSelections[x]).html());
    }
    console.log(e, vals.join(', '));
}


selectList.change(function() {
    getCurrent('click: ');
});
var selectList=$(“#选择”);
var getCurrent=函数(e){
currentSelections=$(“#选择:选定”);
VAL=[];
对于(var x=0;x
这里是指向JSFIDLE的链接

啊。。应该仔细阅读刚才看到的内容,因为它只适用于在IEvar selectList = $("#select"); var getCurrent = function (e) { currentSelections = selectList.find(':selected'); var vals = []; for (var x = 0; x < currentSelections.length; x += 1) { vals.push($(currentSelections[x]).html()); } console.log(e, vals.join(', ')); } selectList.click( function () { getCurrent('click: '); }); selectList.mouseup( function () { getCurrent('mouseup: '); });
var selectList = $("#select");

var getCurrent = function (e) {
    currentSelections = selectList.find(':selected');
    var vals = [];
    for (var x = 0; x < currentSelections.length; x += 1) {
        vals.push($(currentSelections[x]).html());
    }
    console.log(e, vals.join(', '));
}


selectList.click( function () {
    getCurrent('click: ');
});
selectList.mouseup( function () {
    getCurrent('mouesup: ');
});
selectList.change( function () {
    getCurrent('change: ');
});
if (selectList[0].attachEvent) {
    selectList[0].attachEvent('onchange', function () {
        getCurrent('onchange: ');
    });
}
var selectList = $("#select");

var getCurrent = function(e) {
    currentSelections = $("#select :selected");
 vals = [];
    for (var x = 0; x < currentSelections.length; x += 1) {
        vals.push($(currentSelections[x]).html());
    }
    console.log(e, vals.join(', '));
}


selectList.change(function() {
    getCurrent('click: ');
});