DOM manipulation isn't working!

moni170
Tera Contributor

I'm trying to hide the change the background color of the 'Submit' button when the incident form loads by using 'onLoad' client script. I'm using DOM manipulation but it's not working at all!!

Here's the code that i've written and i'm attaching an image to acknowledge the id of the button as well :

 

function onLoad() {
   //Type appropriate comment here, and begin script below

   var save = document.getElementById('sysverb_insert');
   if(save)
   {
       save.style.background = 'green';
       save.style.color = 'white';
   }
   
}
 
The thing is 'Submit' button only appears when we create a new record. Any solution?
1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@moni170 I updated your script slightly and managed to get it working on my instance. Here is the updated script.

 

function onLoad() {
   
	var save = this.document.getElementById('sysverb_insert');
   if(save)
   {
       save.style.background = 'green';
       save.style.color = 'white';
   }
}

 

Also make sure to UNCHECK Isolate Script checkbox

 

Here is how your onLoad script form should look.

 

Screenshot 2023-10-10 at 3.18.26 PM.png

 

Here is the end result.

Screenshot 2023-10-10 at 3.21.05 PM.png

View solution in original post

6 REPLIES 6

Sandeep Rajput
Tera Patron
Tera Patron

@moni170 I updated your script slightly and managed to get it working on my instance. Here is the updated script.

 

function onLoad() {
   
	var save = this.document.getElementById('sysverb_insert');
   if(save)
   {
       save.style.background = 'green';
       save.style.color = 'white';
   }
}

 

Also make sure to UNCHECK Isolate Script checkbox

 

Here is how your onLoad script form should look.

 

Screenshot 2023-10-10 at 3.18.26 PM.png

 

Here is the end result.

Screenshot 2023-10-10 at 3.21.05 PM.png

Thankyou!! It was helpful.