I write the path of a document into the alert box via using below code.
var oArg = new Object();
oArg.Document = $(t).attr("path") + str + "/" + $(t).attr("name");
alert(oArg.Document);
Assume that message is : "documents/files/img/stack.jpg
"
I only want to copy this text with a button. For Chrome Ctrl + C is ok for it but for IE, Ctrl + C copies everything at the alertbox.
How can I copy only the message with using a button?
Ctrl + C works like below:
Was this reply helpful? Alt+PrintScreen will copy the active window (in this case the dialog box) to the Windows Clipboard. You can then paste it into a document.
Alert Box. Use the alert() function to display a message to the user that requires their attention. This alert box will have the OK button to close the alert box. The alert() function takes a paramter of any type e.g., string, number, boolean etc.
What you can do is to prompt the user with the text and ask them to copy it. As such:
prompt("Copy to clipboard: Ctrl+C, Enter", oArg.Document);
Because if you supply a text to the prompt it automatically gets selected. Does this suit you?
When ever the alert message box appears with the text message , just press CTRL+ C and your message will be copied, then you can paste it anywhere you want , no need to write it or using any other method to get the text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With