====== Copying to clipboard ====== * [[https://www.w3schools.com/howto/howto_js_copy_clipboard.asp|Copy to clipboard]] + [[https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript|SO]] You can [[https://www.w3schools.com/jsref/met_textarea_select.asp|select all the text in a textarea]], and also fill it with the variable you want before. The textarea need to be visible for the text to be selected, and you can't juste hide it just after. ////////////////////////////////////// // Javascript $(document).ready(function() { $('.copy-ids').on('click', function(e) { var to_copy = ''; $('.id_to_copy').each(function(index) { to_copy = to_copy + $(this).html() + ' ; '; }); $('.paste-ids').html(to_copy).css('visibility', 'visible'); $('.paste-ids')[0].select(); document.execCommand("copy"); // TODO : indicateur visuel }); }); ////////////////////////////////////// // HTML