Adding JavaScript to show/hide field
JIRA comes with tons of functionalities and customizations; however, there are times when you want more control over the behavior of HTML fields. For instance, if you want to show or hide a particular custom field on the basis of a value of another custom field, you can use custom JavaScript to do this.
Let's take a scenario where users who create a ticket in JIRA need to enter their analysis in one of the text areas based on the custom field, but they only need to fill it in when the priority of the issue is highest. Now, in order to achieve this, we want to completely hide the Analysis field first, and display it only when users set Priority as Highest.
Unlike the preceding example for inserting custom CSS, the custom JavaScript can be added directly from the JIRA interface. Perform these steps:
- Go to JIRA Administration | Issues | Custom fields (under FIELDS).
- Click on the Add custom field button in the top-right corner and select Field Type...