How is document.execCommand used? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How is document.execCommand used?

document.execCommand executes a command on an editable text. How is it used ? Any example ? How is it used with commands "copy", "selectAll", "cut" and "paste"

30th Apr 2019, 8:47 PM
Javier Felipe Toribio
Javier Felipe Toribio - avatar
2 Answers
+ 1
For "copy to clipboard" feature, for example. It needs to be paired with textBoxElement.select() Examples : My source: https://code.sololearn.com/WFdpkp5BiOzX/?ref=app My application : https://code.sololearn.com/WMSROPdKNoCl/?ref=app
1st May 2019, 1:12 AM
Gordon
Gordon - avatar
+ 7
Thanks Gordon !!
2nd May 2019, 5:47 AM
Javier Felipe Toribio
Javier Felipe Toribio - avatar