【发布时间】:2011-08-24 11:05:29
【问题描述】:
这是来自 IE HTML 编辑器的部分代码:
var selectStr = [];
selectStr.push("img[control_type='video']");
$(selectStr[0], document).selectionchange(function() {
alert();
}); // Explorer error: does not support this method or object.
// It seems JQuery does not support 'selectionchange' event.
document.onselectionchange = function(){
alert();
} // this works for all elements in the editor.
它只能应用于特定元素吗?我试过了:
$(selectStr[0], document).onselectionchange = function(){
alert();
} // does not fire when selected.
alert($(selectStr[0], document)); // [object, object]
如果将$(selectStr[0], document) 更改为SOMETHING 以提醒[object, HTMLImgElement],则问题将得到解决。谁知道如何以正确的方式做到这一点?
【问题讨论】:
-
答案是
$("img[control_type='video']", document)[0]。谢谢,伙计们!
标签: javascript jquery editor