Forums

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

Without plugins, How to hide fields based on another field value selection

Badana Shanmukha Teja March 15, 2022

Please let us know, Without plugins, How to hide fields based on another field value selection

1 answer

0 votes
Piyush A (STR)
Community Champion
March 16, 2022

Interesting, You've to add the javascript in the announcement banner  wherein you read value and do the hiding to another field.

 

You may have to do some r&d on the below:

Example:  Hide or Shown and custom field based on priority. 

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {

    hideOrShowPriority();

});

AJS.$(document).ready(function () {

    hideOrShowPriority();

});

AJS.$('#priority').change(function () {

    hideOrShowPriority();

});

function hideOrShowPriority(){

    var priorityVal = AJS.$('#priority').val();

    if (priorityVal == '2'){

    AJS.$("#customfield_10806").closest('div.field-group').show();

    }

    else {

    AJS.$("#customfield_10806").closest('div.field-group').hide();

    }

}
Badana Shanmukha Teja March 16, 2022

Thanks for suggestion, I've tried this script added into announcement banner according to the fields, but no luck, the added script is showing like banner on every screen. Do you have any existed working script from your environment ?

Piyush A (STR)
Community Champion
March 16, 2022

Did you added the style?

 

<script type="text/javascript”>
Above code
</script>

Suggest an answer

Log in or Sign up to answer