Modify Button Text using Javascript | Community
Skip to main content
September 5, 2017
Solved

Modify Button Text using Javascript

  • September 5, 2017
  • 1 reply
  • 5711 views

Hello,

I'm leveraging an embedded global form on many external pages, and I'd like to be able to modify the button text depending on the page. In order to do this I was hoping I could add custom javascript to the embed code - is this possible? I wasn't able to find anything that got me there.

Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

You don't even need JS, just CSS. Set the button text to empty by default.

Then:

.mktoForm button[type="submit"]:after {

    content: "Go Get 'Em";

}

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
September 5, 2017

You don't even need JS, just CSS. Set the button text to empty by default.

Then:

.mktoForm button[type="submit"]:after {

    content: "Go Get 'Em";

}

September 5, 2017

Thanks, @Sanford Whiteman - super helpful. I set the button text to empty in the form editor, but it seems to be defaulting to "Submit" anyway, so now I'm seeing my new text after"Submit." Any other tips on how to clear that out?

SanfordWhiteman
New Participant
September 6, 2017

You actually want a space rather than blank, IIRC.