Imagine you have a total of 25 different names stored in localStorage. How can you easily copy and paste this data from localStorage to clipboard by simply clicking buttons?
Take a look at the button code that is designed to copy the localStorage data:
<a href="" onclick="copyjson()"><div id="Shape1"><div id="Shape1_text"><span style="color:#303C49;font-family:Arial;font-size:16px;"><strong>Copy Data</strong></span></div></div></a>
I attempted to implement a JavaScript function to copy the data, but for some reason it only works when executed through the console:
function copyjson() {
copy(JSON.stringify(localStorage));
}