Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JS in description field no longer working

Jamie Kelly
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 19, 2020

I recently updated to Jira v8.8.0. 

After updating, the JS in the description of some custom fields no longer works. I suspect its because the ability to run JS in the description is gone [As suggested by this https://community.atlassian.com/t5/Jira-Software-questions/Injecting-JS-in-description-of-custom-fields/qaq-p/1292325

 

However, the JS is showing the option "Value='-1' " in red, so it may be that something else has changed.

I'm sorry if this is a blatant fix, I've only recently began working on Jira. 

 

The code:

<script type="text/javascript">
(function($) {
AJS.$("#customfield_10203 option[value='-1']").remove(); //Removes the default value "None"
function convertMulti(id){
if (AJS.$('#'+id+"-textarea").length == 0){
new AJS.MultiSelect({
element: $("#"+id),
itemAttrDisplayed: "label",
errorMessage: AJS.params.multiselectComponentsError
});
}
}

AJS.toInit(function(){
convertMulti("customfield_10203");
})

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
AJS.$("#customfield_10203 option[value='-1']").remove();
convertMulti("customfield_10203");
});
})(AJS.$);
</script>
Building access equipment being given to/returned by an employee.

0 answers

Suggest an answer

Log in or Sign up to answer