copy field meta with content
HTML
<form id="the-form" action='#'>
<div class='field'>
<input placeholder='Nickname' type='text'>
<label>Nickname</label>
</div>
<div class='field'>
<input placeholder='Age' type='text'>
<label>How old are you?</label>
</div>
<div class='field'>
<input placeholder='What city were you born in?' type='text'>
<label>Where were you born?</label>
</div>
<div style="display:none;" class='field'>
<label for='checkme'>
Terms and Conditions
</label>
<input id='checkme' type='checkbox'>
</div>
<ul class="button">
<li>
<div class='field form-actions'>
<button type='button' onclick="copyToClipboard()">Copy to Clipboard</button>
</div>
</li>
</ul>
</form>
<form id="paste">
<textarea placeholder="Paste here" class="bix" name="Text1" cols="40" rows="5" type="text">
</textarea>
</form>
JavaScript
function copyToClipboard() {
/*get inputs from form */
var inputs = document.querySelectorAll("#the-form input[type=text]");
/*do a copy of placeholder and contents*/
var clipboardText = ''
for (var i = 0, input; input = inputs[i++];) {
clipboardText += input.placeholder+': '+(input.value ? input.value : '' )+'\n';
}
/*create hidden textarea with the content and select it*/
var clipboard = document.createElement("textarea");
clipboard.style.height = 0;
clipboard.style.width = 0;
clipboard.value = clipboardText;
document.body.appendChild(clipboard);
clipboard.select();
console.log(clipboard.value);
/*do a copy fren*/
try {
if(document.execCommand('copy'))
console.log('Much succes, wow!');
else
console.log('Very fail, wow!');
} catch (err) {
console.log('Heckin concern, unable to copy');
}
}