0

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";  
}  
}

1 Answer 1

1

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

3
  • i tried but unable to write in code how to change value
    – kumar
    Oct 9, 2020 at 4:36
  • 1
    How do you add the code into moden page?As I test ,it could use document.getElementsByClassName("ms-Button--primary")[0].innerText="test" change the button text.
    – Amos
    Oct 9, 2020 at 9:15
  • yes is working i making sill mistake my bad , many thanks
    – kumar
    Oct 9, 2020 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.