开发者

jQuery: Something wrong with the Event Object?

开发者 https://www.devze.com 2023-01-27 05:08 出处:网络
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:

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

精彩评论

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