jQuery

What happens when you want to make changes to the Jira UI but it is not supported natively by Power Scripts. Use JavaScript and jQuery instead!

Executing JavaScript Code

Running JavaScript code requires Live Fields and the lfExecuteJS() function.

Inspecting and Copying the Query Selector 

Follow these instructions here on copying the element of the query selector.

Query Selector in the View Screen vs. Edit Screen

Please note that the query selector for the same custom field will be different if viewed from the view screen versus the edit screen.

Hiding Custom Fields and Other Graphical Elements

The following code hides the same custom field. However, one refers to the custom field in the view screen ("#customfield_1234-val") and the edit screen ("#customfield_1234").

// From the View screen: AJS.$("#customfield_1234-val").hide();   // From the Edit screen: AJS.$("#customfield_1234").hide();

Showing Custom Fields and Other Graphical Elements

The following code hides the same custom field. Again, one refers to the custom field in the view screen ("#customfield_1234-val") and the edit screen ("#customfield_1234").

// From the View screen: AJS.$("#customfield_1234-val").show();   // From the Edit screen: AJS.$("#customfield_1234").show();

Changing the Background Color of A Custom Field

AJS.$("#customfield_1234").css("background-color","blue"); AJS.$("#customfield_1234-val").css("background-color","blue");

Adding an asterisk to a custom field

To add an asterisk to a custom field, append "aui-icon" and "icon-required" classes to the custom field element using the siblings() formula.

 Additional Help

Need help implementing this script? Talk to me directly to me by clicking on the bot on this page.

Related articles

Filter by label

There are no items with the selected labels at this time.