Someone mentioned this and thought it’d be a really cool little add on. This code is to add a button to copy text for your customers and can be linked to any field in a details section.
You just need to add the view and field number
Javascript
$(document).on('knack-view-render.view_22', function() {
var $button = $('<button class="copyText">Copy</button>');
$('.field_10 .kn-detail-body').prepend($button);
$button.click(function() {
var $input = $('<input>');
var copiedText = $('.field_10 .kn-detail-body span').text();
$input.val(copiedText);
$('body').append($input);
$input.select();
document.execCommand('copy');
$input.remove();
$button.html('Copied ✅');
});
});
CSS
.copyText {
margin:10px 0px!important;
background:rgb(33, 136, 214);
color:white;
font-weight: bold;
border-radius:.6em;
padding:5px 7px;
border:none!important;
cursor:pointer;
}
Any questions just leave them below