Results 1 to 4 of 4

Thread: Enable a form button after a short delay?

  1. #1
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Enable a form button after a short delay?

    Hi.

    I'm trying to find a way to disable a 'Continue' button for 15 seconds or so after a page is loaded. Does anyone know how I might do this? I'm thinking of it working is a similar way to how Firefox disables the 'Ok' button for 3 seconds before allowing you to install a plugin, to encourage you to read the security warning.

    Any suggestions would be much appreciated, however I know next to nothing about JS . Thanks.
    Last edited by Chimpanzee; 02-14-2010 at 02:53 PM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Give the continue button the id of continue, and then insert this code below him:
    Code:
    <script type="text/javascript">
    document.getElementById('continue').disabled = true;
    setTimeout(function(){
      document.getElementById('continue').disabled = false;
    }, 15000);
    </script>
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    Chimpanzee (02-12-2010)

  4. #3
    Join Date
    Feb 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    Give the continue button the id of continue, and then insert this code below him:
    Code:
    <script type="text/javascript">
    document.getElementById('continue').disabled = true;
    setTimeout(function(){
      document.getElementById('continue').disabled = false;
    }, 15000);
    </script>
    ...and it's that easy! Thank you so much. I just altered it slightly:
    Code:
    <script type="text/javascript">
    document.getElementById('continue').disabled = true;
    document.getElementById('continue').value = "Please wait...";
    setTimeout(function(){
      document.getElementById('continue').disabled = false;
      document.getElementById('continue').value = "Continue";
    }, 15000);
    </script>
    Thanks!

  5. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Glad to help you! Your welcome!

    It seems your topic is solved... Please set the status to resolved.. To do this:
    Go to your first post ->
    Edit your first post ->
    Click "Go Advanced" ->
    Then in the drop down next to the title, select "RESOLVED"
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •