Change text on form "Submit" button after actioned

Is there anyway/recommendation (even with general html/css - looking into this further) to change the text on the “Submit” or click here to submit button on the suProcessing: Submit button change…
rvey/form and change the text. I.e. “Submit” > “Thank you for your submission”. Currently stuck with this code for the submit button

Thank you - any help is appreciated! These projects have been quite cool.

I know you can do it with JS, but not sure you could do it with html/css, cos the ‘thank you’ text would have to appear after the submission, but you dont have any page reloads :thinking: it’s a good question, though, maybe with :after pseudoclass? not sure they’d work on a input element, but may be a place to start searching =]

I did something similar in a course I am taking. Let me see if I can come up with something.
It may be easier to view and hide an element with the message you want after submission.

This code will work:

<input id="submit-btn" type="submit" value="Click here to submit">
let submitBtn = document.getElementById("submit-btn");

function changeText(){
    submitBtn.value = 'Thank you for your submission';

submitBtn.addEventListener('click', changeText)

You had no click event on the button to get the javascript to run. The code doesn’t work on a button because the value attribute is different. The return: false stops the form from submitting which you don’t want to do. You will have to style the input to look like the original button.