Alternative for document.getElementByClassName in Portal

Donabelle
Tera Contributor

Hi,

 

Is there any other workaround for document.getElementByClassName since this is not working in portal. 

2 REPLIES 2

Prasad Dhumal
Mega Sage
Mega Sage

Hello Donabelle,

It should be 'document.getElementsByClassName' I think. Its Plural. 

If that doesn't work, try 'document.querySelector(".class-name")'

Community Alums
Not applicable

Hello @Donabelle ,

ServiceNow has effectively prevented its customers from utilizing any form of DOM manipulation in the service portal. Please refer the below link to enable DOM manipulation in ServiceNow service portal catalog client scripts:-

https://snprotips.com/blog/2017/7/21/how-to-enable-dom-manipulation-in-the-servicenow-service-portal

 

Thank you!