Documentation for JIRA 5.1.x. Documentation for other versions of JIRA is available too.
Please note that adding Javascript to custom fields is a customisation and not maintained as a supported part of JIRA.
There are several ways to inject JavaScript or HTML into JIRA: