Question

i am trying to change button name from Save to Submit using extension but its not working below is my code

let newbutton: any = document.getElementsByClassName("ReactClientFormSection")[1] || document.documentElement;  
//debugger;
newbutton.style.display='none';
let newbutton2: any = document.getElementsByClassName("ReactFieldEditor")[13] || document.documentElement;  
newbutton2.style.display='none';
var inputs = document.getElementsByClassName("ReactClientForm-editButtons");  
//Get the "Save" button  
for(var i = 0; i<inputs.length; i++)  
{  
if(inputs[i].innerHTML == "button" && inputs[i].innerHTML == "Save")  
{  
//Change the "Save" button's Text to "Submit"  
inputs[i].innerHTML = "Submit";  
}  
}
Was it helpful?

Solution

inputs[i].innerHTML cannot be equal to two values at the same time. enter image description here

You could change the class to ms-Button--primary.

document.getElementsByClassName("ms-Button--primary")[0].innerText

enter image description here

Updated: enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top