With the jQuery below, I’m able to copy the content into clipboard but not to retain the line breaks.
HTML:
<td width="700" id="message_id2">
We are sorry you are not happy with your purchase.
Here are your return instructions:Repackage the product as carefully as you can so that it is returned in the condition it was sent to you. Please take EXTREME CARE with the product packaging.
Your return label is attached. Everything we need to know to process your return is on the return label - there's no need to include documentation etc.<br><br>Take the package to a UPS drop location such as a UPS store, a local package store that accepts UPS shipments, Office Depot, Office Max, Staples, and many other locations. To find a location near you, you can go to https://www.ups.com/dropoff?loc=en_US <br><br>When your return is received, inspection and processing will occur on Saturday and your refund will be issued on the following Monday. The UPS charge will be deducted from the refund amount. </td>
jQuery:
// copies a canned message to clipboard from maintenance page in POMS
$(".copy_button").click(function(){
selected_id = $(this).attr("id");
$("#"+selected_id).css({"background-color":"#FFF","color":"#009","border":"3px solid #009"});
$("#"+selected_id).text("Copied");
message = $("#message_id"+selected_id.substr(13)).text();
alert('message: ' + message);
navigator.clipboard.writeText(message.substr(3));
setTimeout(reconfigure_button_function,750);
});
The output I need to see is:
We are sorry you are not happy with your purchase. Here are your return instructions:Repackage the product as carefully as you can so that it is returned in the condition it was sent to you. Please take EXTREME CARE with the product packaging. Your return label is attached. Everything we need to know to process your return is on the return label – there’s no need to include documentation etc.
Take the package to a UPS drop location such as a UPS store, a local package store that accepts UPS shipments, Office Depot, Office Max, Staples, and many other locations. To find a location near you, you can go to https://www.ups.com/dropoff?loc=en_US
When your return is received, inspection and processing will occur on Saturday and your refund will be issued on the following Monday. The UPS charge will be deducted from the refund amount.