Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.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 在另一个元素上触发jQuery事件对象_Javascript_Jquery_Javascript Events_Mouseevent - Fatal编程技术网

Javascript 在另一个元素上触发jQuery事件对象

Javascript 在另一个元素上触发jQuery事件对象,javascript,jquery,javascript-events,mouseevent,Javascript,Jquery,Javascript Events,Mouseevent,我有一个简单的类似CodeMirror的设置,其中父div(在中透明的)覆盖 output.bind('mousedown', function(event) { event.preventDefault(); label.css('pointer-events', 'auto'); //this isn't real event.target = label; event.apply(); }); label.bind('mouseup', funct

我有一个简单的类似CodeMirror的设置,其中父div(在
中透明的
)覆盖

output.bind('mousedown', function(event) {
    event.preventDefault();
    label.css('pointer-events', 'auto');

    //this isn't real
    event.target = label;
    event.apply();
});
label.bind('mouseup', function(event) {
    label.css('pointer-events', 'none')
});
如果你能想出一些与IE10兼容的东西(没有指针事件),那就更好了

谢谢

-

编辑:有label.trigger(事件),但没有正确反映用例


如果有一个与event.preventDefault()相反的函数,比如event.triggerDefault(),那就是我想要触发的。

您好,我想更好地了解您的用例。是什么阻止您先执行label.trigger(“myEvent”,event),然后再执行label.bind(“myEvent”,function(event){……那么您想触发mouseup事件?
label.trigger(“mouseup”)
或者您想在不同的对象上触发相同的事件?当您单击文本区域时,它会将插入符号放在您单击的位置。您不能只在文本区域上触发click()。