Where to place each code?

Hi all,

I found this neat trick to “Copy to Clipboard” from David Walsh.
I understand that “Copying and Cutting Values of Textarea and Input” & “Copying Element innerHTML” go in the <body> tag.
But what about “Target and Text Functions” & “Events” ? Do I need a <script> tag for these? If so, does it go in the <head> tag, or in the <body>?

Thanks in advance guys!