Skip to content

Commit

Permalink
jquery.filedrop.js compatible with jQuery 3.4.1
Browse files Browse the repository at this point in the history
These little changes solves error "Syntax error, unrecognized expression: #"
Changes is commented in code.
Tested in jQuery  3.4.1
  • Loading branch information
Nailuj2000 authored Sep 12, 2020
1 parent 972740b commit 14f93d7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions jquery.filedrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
;(function($) {

var default_opts = {
fallback_id: '',
fallback_dropzoneClick : true,
fallback_id: '', // if this opt is set then change fallback_dropzoneClick to true
fallback_dropzoneClick : false, // change to false because if fallback_id is '' by default
url: '',
refresh: 1000,
paramname: 'userfile',
Expand Down Expand Up @@ -95,15 +95,16 @@
$('#' + opts.fallback_id).trigger(e);
});
}
}

$('#' + opts.fallback_id).change(function(e) {
opts.drop(e);
files = e.target.files;
files_count = files.length;
upload();
});


$('#' + opts.fallback_id).change(function(e) { // This generate the error "Syntax error, unrecognized expression: #"
opts.drop(e); // in newer versions of jQuery. Solved moving line 98 to 106 :)
files = e.target.files;
files_count = files.length;
upload();
});

} // Moved here from line 98

function drop(e) {
if( opts.drop.call(this, e) === false ) return false;
if(!e.originalEvent.dataTransfer)
Expand Down

1 comment on commit 14f93d7

@stevenwongts
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work @Nailuj2000 much appreciated on what you have done!

Please sign in to comment.