欧阳克2017-06-28 09:29:32
The
click of the
element should have the same effect as the manual click.
First of all b.className
is not b.class
Although I have never used this Clipboard library, literally it is to obtain the .copybutton
class through the selector, so you should not be able to obtain it without mounting b on the dom tree. You can try adding document.body.appendChild(b)
in front.
Finally, I suggest you ask questions in the same way as the comments above. Post more code and less pictures, which is inconvenient to read.
某草草2017-06-28 09:29:32
Um, .click()
That’s the abbreviation of jQ, natively you have to call dispatchEvent()
…
Reference
三叔2017-06-28 09:29:32
Problem: Native objects and jq objects are mixed up
Change the first line to:
var $b = $('<input type="button" />') Try it