Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hide portal Header

eyala
Tera Contributor

Hello everyone, I want to hide via client script on load the banner in portal.
is it possible to do it like this ?

function onLoad() {
var x = document.querySelector('div[aria-label="Primary"]');
x[0].style.display = "none";
}

Tried it also with getElemntByClassName() with no luck

3 REPLIES 3

Manikanta Kota
Mega Guru

Hi @eyala ,

 

edit  the CSS Of that Widget .

.sp-banner {
display: none;
}

 

Should my answer prove to be helpful, kindly mark it as such by clicking "Accept as Solution" and "Helpful."

 

Regards,

Manikanta. Kota

I cannot edit the widget, The page is Record producer. can I add the on load there ?

Hi @eyala ,

Not Sure the right process But Try with this. Please let me Know if it works

function onLoad() {
// Find the top banner by its CSS class
var topBanner = document.querySelector('.navbar-header');

// If the top banner is found, hide it
if (topBanner) {
topBanner.style.display = 'none';
}
}

Should my answer prove to be helpful, kindly mark it as such by clicking "Accept as Solution" and "Helpful."

 

Regards,

Manikanta. Kota