I have a simple form: https://jsfiddle.net/skootsa/8j0ycvsp/6/
<div class='field'>
<input placeholder='Nickname' type='text'>
</div>
<div class='field'>
<input placeholder='Age' type='text'>
</div>
How would I get a button that copied the contents of each input box + the "placeholder" attribute (or class name)? So that the clipboard results looked like this:
Nickname: Johnnyboy
Age: 22
You need to:
document.execCommand('copy')
to copy the selected text to the clipboardI have updated your fiddle, check it out https://jsfiddle.net/8j0ycvsp/9/
In case you want the code
So give it a try