var dummyContent = "this is to be copied to clipboard"; var dummy = $('<input>').val(dummyContent).appendTo('body').select() document.execCommand('copy')