Ankur Bawiskar
Tera Patron
Tera Patron

Many a times there is a requirement to add some css to variable label such as making bold.

I am sharing sample script for the same, you can enhance it as per your requirement.

You can use this catalog client script onLoad and make the Label variable as Bold

Script: This will work in both native + portal

1) Ensure Isolate Script field is set to false for this client script

2) This field is not on form but from list you can make it false

function onLoad(){

	setTimeout(function(){ 
		
		if(window != null){
			// native
			g_form.getControl('variableName').setAttribute('style', 'font-weight: bold;color:blue');
		}
		else{
			// portal
			var aTags = this.document.getElementsByClassName("ng-binding");
			var searchText = "My Label"; // give the label name here
			var found;

			for (var i = 0; i < aTags.length; i++) {
				if (aTags[i].textContent.toString() == searchText) {
					aTags[i].style.fontWeight = 'bold';
					break;
				}
			}
		}

	}, 3000);

}

AnkurBawiskar_0-1735379820233.png

 

 

Output:

Native:

AnkurBawiskar_1-1735379820220.png

 

 

Portal:

AnkurBawiskar_2-1735379820212.png

 

 

Version history
Last update:
‎12-28-2024 01:59 AM
Updated by:
Contributors