Select content using Touch Directives
-
Hello everybody.
I was making a module for my application that will work directly with ticket for payments (here, in brazil, we call ‘boleto’).
That is a simply document with a barcode.I was making a screen with only the digitable line, for mobile. But i cannot “select” the content when i use the touch directives.
Someone can help me with another solution, i don’t like to open hand of that functionality because that conflict.
Sorry my english.
Thanks !! -
Try with
document.execCommand('copy')
which ia native in modern browsers. (don’t forget to programmatically select the text you want to be copied first —DOMElement.select()
)Do a search here for ‘document.execCommand’: https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
It’s second response I think.You’ll also find browser support there:
- IE10+
- Google Chrome 43+ (~April 2015)
- Mozilla Firefox 41+ (shipping ~September 2015)
- Opera 29+ (based on Chromium 42, ~April 2015)