Hide Annotations

gaidem
ServiceNow Employee
ServiceNow Employee

I've gotten the element ID and tried doing a .style.display='none'; This seemed like a long shot, so I'm not surprised it didn't work. Does anyone know how to conditionally show/hide an annotation?

Thanks!

Matt

21 REPLIES 21

airwin77
Kilo Contributor

The script that was posted above worked great.

Here is the Annotation
This "span" HTML element defines an ID, which can be used by code to find it and show/hide it. The client script to show/ hide this would look like this.
//to hide it
$("annotation_1").up(0).hide();
//to show it
$("annotation_1").up(0).show();


Thanks


rsanon
Tera Contributor

I am looking to do something similar...



I have an On Change Client Script, I would like to show an annotation label only show when a particular value is selected



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue == '') {


          return;


    }


  if (newValue == 'Yes')


  {


    document.getElementById("ano1").parentNode.style.display="block";


  }


  else


  {


  document.getElementById("ano1").parentNode.style.display="none";


  }



}



The choice value defaults to none, when I load the page, the label is still present. I only want the label to be present when "Yes" is selected as a choice.



Not sure what is missing to achieve this. Any ideas?