Modify Button Text using Javascript | Community
Skip to main content
Sep 5, 2017 9:38 PM UTC
Solved

Modify Button Text using Javascript

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.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Sep 5, 2017 10:52 PM UTC

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

}

7 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Sep 5, 2017 10:52 PM UTC

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

}

Translate
Sep 5, 2017 11:44 PM UTC

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?

Translate
SanfordWhiteman
Level 10
Sep 6, 2017 12:06 AM UTC

You actually want a space rather than blank, IIRC.

Translate