How to make variable bold and blue in color in catalog item

Gayathri5
Tera Guru

Hi Developers.,

 

I have written below onload script but it is unsuccessful, please help me

 

First method:
var el = g_form.getControl('project_name');
el.style.color = 'red';
el.style.fontWeight = 'bold';

2nd method
 var l = g_form.getLabel('ns_new_laptop_msg');
 l.style.fontWeight='bold';
  l.style.color= 'blue';
 
 
Please do specify any other methods.
 
Regards,
Gayathri
2 REPLIES 2

Sagar Pagar
Tera Patron

Hi @Gayathri5,

 

Take a look at this article: Field Styles for Service Catalog Variables 

It will help you to apply field styles for catalog item variables.

 

If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

yaswanthi2
Giga Sage

Hi @Gayathri5 

try DOM in onload while check isolated script as false

function onLoad() {

    var el = document.getElementById("label_IO:058232e197243110c6257076f053af02"); // get label id of your field by inspect the form

    el.style.color = 'blue';

}