Note there is a pretty interesting trick described in the answer referenced above.
That said, browser make using clipboard pretty difficult, because automatic copy without the user consent it pretty dangerous; the user is unaware of that and can loose some data previously put to the clipboard. So, better don't do it at all.
Here is my advice: find any CodeProject code sample, say, your own code sample on this very page. Please click on "Copy Code". Are you getting the idea?
So, this is what I advise: use the CodeProject way: this is the simplest and at the same time the safest solution.