This demo shows a popup that says "copied!" for a short time. The popup is controled by CSS animation, not a timer.
To use the copy() function, create a div containing two spans. The first span contains the text to be copied and has the onclick. The second span contains the text to be displayed that indicates the contents was copied. Position the second span relative to the div.