Alternative method for document.getElementsByClassName.

Saumil S Parekh
Tera Contributor

Hi,

Can anyone please help with an alternative method for document.getElementsByClassName as DOM manipulation should be avoided in client scripts

Below is the example code

 

Execute if True:

 
function onCondition() {
       var thePostButton = document.getElementsByClassName('btn btn-default activity-submit');
       for (var i =0; i < thePostButton.length; i++) {
       thePostButton[i].style.color = 'transparent';
       thePostButton[i].style.background = 'transparent';
       thePostButton[i].style.border = 'none';
       thePostButton[i].style.visibility = 'hidden';
       }
}
3 REPLIES 3

Ashish Parab
Mega Sage

@Saumil S Parekh 

 

you can refer below link -

https://servicenow.com/community/developer-forum/alternative-to-dom/m-p/2107980/page/2

 

Please mark helpful or correct, if it is applicable for your case.

Thanks & Regards,

Ashish

 

 

Thank you for post however this solution does not serve my purpose. 

Saumil S Parekh
Tera Contributor

No it did not solve my problem