Javascript Events – Hide Submit Button until last field is filled out

0

Hi everyone,

I am wanting the Submit button to not display until my last input box is filled out.

I started with using pure Javascipt –

In the CSS I set .sg-button-bar display:none

document.getElementById(‘sgE-5555555-1-29-element’).addEventListener(“input”, toggleButton());

function toggleButton() {
document.getElementsByClassName(‘sg-button-bar’).style.display=”block”;
}

 

I had no success with this.

So then I started attempting to use a few different variations of jquery

document.getElementById(‘sgE-2439539-1-29-element’).addEventListener(“input”, toggleButton());

function toggleButton() {
console.log(“Hey”);
document.getElementsByClassName(‘sg-button-bar’).style.display=”block”;
}

So then I attempted :

document.getElementById(‘sgE-2439539-1-29-element’).addEventListener(“input”, toggleButton());

function toggleButton() {
console.log(“Hey”);
document.getElementsByClassName(‘sg-button-bar’).style.display=”block”;
}

I am beating my head in here trying to figure out why I can’t get events to successfully perform a function.

Jacob Hayslett asked
    0

    Other than SG customers, any chance a SG developer can join in the discussion here?

    Jacob Hayslett answered
      0

      Hey Jacob – I just happened to run across this question. In the past I’ve used something like this:

       

      $(document).ready(function(){
      $(“#sg_SubmitButton”).hide();
      $(“#sgE-2542411-1-5-element”).change(function(){
      $(“#sg_SubmitButton”).show();
      });
      });

      Let me know if that helps!

      Lizzy Tekkel answered
        ×

        Login

        Question stats

        • Active
        • Views1332 times
        • Answers2 answers
        • Followers0 followers