function String2Hex(tmp) { var str = ''; for(var i = 0; i < tmp.length; i++) { str += tmp[i].charCodeAt(0).toString(16); } return str; } function hex2a(hex) { var str = ''; for (var i = 0; i < hex.length; i += 2) str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); return str; } function copyToClipboard(element) { var $temp = $(""); $("body").append($temp); $temp.val($(element).text()).select(); document.execCommand("copy"); $temp.remove(); }