It is possible to get the value of input type hidden ?
The input :
<input type='hidden' value='mysekretvalue' id='hidden-0' />
The link :
<a href='#' class='link-copy' title='copy to clipboard' data-clipboard-target='#hidden-0'>
Solution:
var inputhidden = $(this).next();
new Clipboard('.link-copy', {
text: function (trigger) {
return inputhidden.val();
}
});
This feels like a common use case, would it be worth adding a note about it in the readme?
It was a little strange debugging this using the vanilla setup, the success event fires but the clipboard hasn't changed.
I'm having trouble copying the contents of any input field that's hidden using CSS.
Most helpful comment
Solution: