With flash on the way out in many environments (iPhone, Android, IE10, etc...), is there any new solution forthcoming in any browsers that will allow a safe copy of informat
There are great answers to this question, and I chose to use this snippet:
function copyToClipboard(element) {
var $temp = $("");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
}
However, if there's bootstrap-select on your page, the $temp.val($(element).text()).select() line will throw an error:
Widget can only work on select elements
You can use .trigger('select') instead, as stated in the jQuery documentation for .select(), like this:
$temp.val($(element).val()).trigger('select');