Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    109
    Thanks
    21
    Thanked 0 Times in 0 Posts

    Repeat function js not working

    Hi.

    I am learning javascript but my repeat function is not working. Trying to get alert to pop up every 30 seconds in js not to sure what doing wrong

    http://codepen.io/CarraraWebsiteSolutions/pen/cKdGE
    Founder Of Carrara Website Solutions
    http://www.carrarawebsitesolutions.com

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,507 Times in 2,485 Posts
    Surely you are not trying to use jQuery for something as trivial as that?

    "Political langauge - and with variations this is true of all political parties from Conservatives to Anarchists - is designed to make lies sound truthful and murder respectable, and to give the appearance of solidity to pure wind". - George Orwell, English novelist and journalist, 1903-1950.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    109
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    Surely you are not trying to use jQuery for something as trivial as that?

    "Political langauge - and with variations this is true of all political parties from Conservatives to Anarchists - is designed to make lies sound truthful and murder respectable, and to give the appearance of solidity to pure wind". - George Orwell, English novelist and journalist, 1903-1950.
    I am just self teaching so got to start some where.
    Founder Of Carrara Website Solutions
    http://www.carrarawebsitesolutions.com

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,471
    Thanks
    6
    Thanked 980 Times in 953 Posts
    If you are trying to get started with JavaScript, then learn JavaScript, not a derivative JS framework. jQuery is used most effectively if you actually know at least the basic principles of plain JavaScript first.

    To repeat a function JavaScript (not jQuery!) has the setInterval() method.

  • #5
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    109
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    If you are trying to get started with JavaScript, then learn JavaScript, not a derivative JS framework. jQuery is used most effectively if you actually know at least the basic principles of plain JavaScript first.

    To repeat a function JavaScript (not jQuery!) has the setInterval() method.
    I was working away at code just before came up with this does the trick

    Code:
    $(".alert").delay(800).addClass("in").fadeOut(6000);
    
    var auto_refresh = setInterval(
    function ()
    {
    $('.alert').fadeIn("slow");
    }, 10000);
    Founder Of Carrara Website Solutions
    http://www.carrarawebsitesolutions.com


  •  

    Tags for this Thread

    Posting Permissions

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