开发者

jQuery: Something wrong with the Event Object?

While this works:

jsfiddle.net/ktnH8/

This does not:

jsfiddle.net/ktnH8/1/

What is the problem with the latter? I only have changed this:

var dropZone = document.getElementById('drop_zone');
dropZone.addEventListener('dragover', handleDragOver, false);
dropZone.addEventListen开发者_C百科er('drop', handleFileSelect, false); 

To this:

$('#drop_zone).bind('dragover', handleDragOver, false);
$('#drop_zone).bind('drop', handleFileSelect, false); 


Your syntax is invalid, you're missing some closing quotes '.

Also, look at the documentation for the possible .bind syntax:

.bind( eventType, [ eventData ], handler(eventObject) )
.bind( eventType, [ eventData ], false )

You'll have to use $('#drop_zone').bind('dragover', handleDragOver), otherwise handleDragOver is interpreted to be the eventData parameter, not as the handler parameter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜