Alternative for document.getElementByClassName in Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 09:29 PM
Hi,
Is there any other workaround for document.getElementByClassName since this is not working in portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 09:46 PM
Hello Donabelle,
It should be 'document.getElementsByClassName' I think. Its Plural.
If that doesn't work, try 'document.querySelector(".class-name")'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 11:42 PM
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!