Hi I would like to know the way with which I can straight away copy the text in alert box, it is allowing me to copy the text in IE, Safari but not in latest chrome version. Any idea how to do the same.
Thanks
I've had this problem, as I've wanted to copy text in an alert to a translator since it was in a language I didn't read.
What I ended up doing was:
While on the page that causes the alert to appear, open Chrome's developer tools by typing (F12) or (CTRL SHIFT I) or Menu-> More Tools -> Developer tools.
Go to the developer tools console pane and, at the text entry prompt starting with >
, type:
alert = ( () => {
const oldAlert = alert;
var inAlert = false;
return (x) => {
if (!inAlert) {
console.log(x);
inAlert = true;
return oldAlert(x)
inAlert=false;
};
}
} )()
That command supplements the alert functionality so that any alert message also gets written to the debug console, where it's easy to copy. Now, do whatever you did that causes the alert to appear and dismiss it. When you go look at that console window, you should see that it has printed the text you wanted to copy. You can copy it from there.
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