Modifying and applying custom javascript to attributes

Permalink
Hi,

This is a very common scenario and almost every time I get stuck with this and I somehow find a roundabout way of doing it. Let's say I have a Page Attribute of type Date/Time. The usual way to print the attribute is like so:
$akt->render();

How can I apply my own javascript to this input? How can I know what will be the ID of this input?