Java script not working

I have two custom fields.One select field .I need one description field to be filled if answe is No

<script type="text/javascript">

FeatureToggle = document.getElementById('12000');

if (FeatureToggle) {

target = document.getElementById('12100');

if (FeatureToggle =='Yes') target.style.display='none';

FeatureToggle.onchange=function() {

if (this.value =='No') {

target.style.display = '';

target.value="Why feature toggle is No";

} else {

target.style.display='none';

}

}

}

</script>

2 answers

0 vote

And your question is ... ?

  1. Please put your code in a code block to improve visibility
  2. What else have you tried?
    1. Already debugged your Javascript code? How should this work? For instance FeatureToggle is an element, how should this be "Yes"?
  3. Put your code in
    jQuery(function(jQuery){ // Your code here});
    to be sure, it is loaded after all elements are rendered.
  4. Use jQuery to add event listeners, find and alter elements, to be sure you are cross browser compatible

is this script correct.Its not working after adding it.Also i added in here custom fields---)right click ---)configure ---)description.

please advise.Als advise if there is anyother script for the requirement

Hi,

Thanks for looking.

I have a select list with yes or No that is FeatureToggle .My requirement is if user selects no he should give expalanation.So i created another field which is a text field.I need this mandatory/fill if he selects no.

Kindly help

Have you tried Adrien's suggestions yet? Repeating the question is of no help, you need to think through the responses you get and respond to them with more information.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

691 views 6 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you