1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wait 1 minute before submitting the form [HELP]

Discussion in 'HTML & JavaScript' started by AnonLeo, Jan 2, 2014.

  1. AnonLeo

    AnonLeo Regular Member

    Joined:
    Nov 23, 2013
    Messages:
    362
    Likes Received:
    263
    Location:
    USA
    Hey,
    There is way too many people are visiting my website, so I want the visitors to wait 1 minute before submitting the form.
    So there will be a time on the 'Submit' button, when time (1 minute) is finished, then the button will be click-able and users can click it to continue.



    Form code:

    <form action='' id='myform' method='post' class="form-wrapper cf" name='myform'>
    <input autocomplete='off' autofocus='' class='text title' id='formid' name='formid' placeholder='' type='text' value=''/>
    <button id="submit_btn" name="submit" onclick='load()' type="submit">Submit</button>
    </form>



     
  2. barigain

    barigain Junior Member

    Joined:
    Aug 23, 2012
    Messages:
    100
    Likes Received:
    12
    try using setTimeout()


    define a function to enable the button, and then set a setTimeout():


    Code:
    function enableButton(){
        $('#myButton').attr("disabled", false);
    }
    
    
    setTimeout(enableButton, 10000);
    make sure to put the function name without quotes and without the "()"
     
    • Thanks Thanks x 1