How to hide "Indicates required" ?

eyal abu hamad
Mega Sage

Hey all,

 

I need to hide the indicator that says "Indicates required", I know its not the best practice but this is what I was been asked for. Tried onload script that catches the class if the indicator but for some reason its returning null.

eyalabuhamad_0-1695799552106.png

this is the script that I wrote

function onLoad() {
 
   //Type appropriate comment here, and begin script below
var aTags = this.document.getElementsByClassName("sc-cat-item-legend ng-scope");
aTags[0].style.display = "none";
   
}
 
and this the error that I get
eyalabuhamad_1-1695799651861.png

also this is the div details

eyalabuhamad_2-1695799687966.png

 

4 REPLIES 4

Radek
Tera Expert

use CSS in Instance Option:

.sc-cat-item-legend {
      display: none;
}

Mohammed Al-Mar
Tera Guru

Hi @eyal abu hamadoccasionally the DOM elements may not load immediately. You can use a timer to allow the page additional time to load.

 

Also, ensure that the "Isolated Script" checkbox is unchecked in the client script record.

function onLoad() {
	setTimeout(function(){
		var mandatoryLegend = this.document.querySelector('.sc-cat-item-legend');
		mandatoryLegend.style.display = 'none';
	}, 100);
}

 

MohammedAlMar_1-1729066908638.png

I'd use this in case there is a need for single catalog item to be modified.

I agree with this comment.