I'm trying to initialize ClipboardJS with a list of elements I got from JQuery:
var elems = someJQueryObject.find("someSelector");
new ClipboardJS(elems);
This doesn't work:
First argument must be a String, HTMLElement, HTMLCollection, or NodeList
I tried to rewrite the first line like so:
var elems = someJQueryObject.find("someSelector").get();
But I still get the same error.
In contrast, using JavaScript native functions:
var elems = document.querySelectorAll("someSelector");
new ClipboardJS(elems);
works. So my question is: how to get the same return type as querySelectorAll returns from a jQuery object? Why doesn't .get()
work? According to docs it should do exactly this.