Uncaught Error: Syntax error, unrecognized expression: #

Uncaught Error: Syntax error, unrecognized expression: #

Hello everyone,
I'm using jQuery v3.3.1 and I have a drad and drop function that is giving some users an error which i can't replicate.
The html:
  1. <div id="target-2" class="dndS-target target-2" ondrop="dndSimpleDropTarget(event);" ondragover="dndSimpleAllowDrop(event);" data-id="2"></div>
The Javascript in question (until the line where the error is called):
  1. function dndSimpleDropTarget(ev) {
  2. ev.preventDefault();
  3. var data = ev.dataTransfer.getData("text");
  4. var here = parseIfInteger($('#' + data).data('id'));

And the error:
  1. jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #
  2. R
  3. U
  4. I
  5. at Function.oe.error (jquery.min.js:2)
  6. at oe.tokenize (jquery.min.js:2)
  7. at oe.select (jquery.min.js:2)
  8. at Function.oe [as find] (jquery.min.js:2)
  9. at w.fn.init.find (jquery.min.js:2)
  10. at new w.fn.init (jquery.min.js:2)
  11. at w (jquery.min.js:2)
  12. at dndSimpleDropTarget (custom.js:193)
  13. at HTMLDivElement.ondrop (index.html:1)
The error isn't consistent, and sometimes occurs, other times (different session) doesn't...
I don't understand why this is and how I can begin to solve it.
Thanks in advance.