Support » Fixing WordPress » How to change button value?

  • Resolved toomeya

    (@toomeya)


    I am attempting to change the text on the submit button in my HTML form. I have tried the following variations of code (as well as several others) and none of them will change the value away from the default (“submit” on Chrome and “submit query” on FF & IE).

    <button onclick=”myFunction()” name=”submit” type=”submit” value=”Submit Form” />Submit</button>
    —This removed the yellow background from my button on Chrome, but didn’t change the result in FF & IE.

    <button onclick=”myFunction()”><input type=”submit” />Submit</button>
    —Default value with yellow background

    <button onclick=”myFunction()”><input type=”submit” value=”submit”/>Submit</button>
    —Default value with yellow background

    <button onclick=”myFunction()” value=”submit”><input type=”submit” value=”submit”/>Submit</button>
    —Default value with yellow background

    Any help would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • vtxyzzy

    (@vtxyzzy)

    I think you need to change the word ‘Submit’ just before the closing </button> tag, like this:

    <button onclick="myFunction()" value="submit"><input type="submit" value="submit"/>My Text</button>

    Thread Starter toomeya

    (@toomeya)

    In this case, the word “Submit” before the closing </button> is the “My Text” that I wanted to use. I wanted the button to say “Submit” but it didn’t, instead it said “Submit Query” (the default) which made no sense in my context. Changing the value of the text using only the in-line code did not have any effect.

    The solution I ended up finding was to go into the WordPress CSS file and create a new class with the features that I wanted and assign the button to that class.

    For those who might find this thread later, this is the code that I ended up using:
    On the page:

    <button class="cpeformbtn" name="submit" type="submit" value="" /><b>Submit</b></button>

    In the WordPress CSS File: (note: I decided if I was going to make a CSS class I might as well make the button look pretty while I was at it)

    .cpeformbtn {
      -webkit-appearance: none;
      background: #17278a;
      background-image: -webkit-linear-gradient(top, #17278a, #2980b9);
      background-image: -moz-linear-gradient(top, #17278a, #2980b9);
      background-image: -ms-linear-gradient(top, #17278a, #2980b9);
      background-image: -o-linear-gradient(top, #17278a, #2980b9);
      background-image: linear-gradient(to bottom, #17278a, #2980b9);
      -webkit-border-radius: 28;
      -moz-border-radius: 28;
      border-radius: 28px;
      font-family: Arial;
      color: #ffff1f;
      font-size: 15px;
      padding: 10px 20px 10px 20px;
      text-decoration: none;
    }

    Thanks for responding.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to change button value?’ is closed to new replies.