javascript - How to copy text of alert box -


i write path of document alert box via using below code.

var oarg = new object(); oarg.document = $(t).attr("path") + str + "/" + $(t).attr("name"); alert(oarg.document); 

assume message : "documents/files/img/stack.jpg"

i want copy text button. chrome ctrl + c ok ie, ctrl + c copies @ alertbox.

how can copy message using button?

ctrl + c works below:

  • chrome - works perfectly.
  • internet explorer - works, text. caption , ok button text copied, along bunch of dashes. never want.
  • firefox - doesn't work @ must select text before can copy it.

what can do, prompt user text, , ask them copy it. such:

prompt("copy clipboard: ctrl+c, enter", oarg.document); 

because if supply text prompt, automatically gets selected. suits you?


Comments