Inspired by this pen, I recoded and updated it to copy to a hidden textarea for use in forms/queries.