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:
- <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):
- function dndSimpleDropTarget(ev) {
- ev.preventDefault();
- var data = ev.dataTransfer.getData("text");
- var here = parseIfInteger($('#' + data).data('id'));
And the error:
- jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #
- R
- U
- I
- at Function.oe.error (jquery.min.js:2)
- at oe.tokenize (jquery.min.js:2)
- at oe.select (jquery.min.js:2)
- at Function.oe [as find] (jquery.min.js:2)
- at w.fn.init.find (jquery.min.js:2)
- at new w.fn.init (jquery.min.js:2)
- at w (jquery.min.js:2)
- at dndSimpleDropTarget (custom.js:193)
- 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.