Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3784314
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:21:30+00:00 2026-05-19T11:21:30+00:00

Hi folks not sure the best way to do this – i.e. where to

  • 0

Hi folks not sure the best way to do this – i.e. where to put the if‘s .. I have a div that loads a page and has a setInterval() function.

On the loaded page there is 1 button, What I want to acheive is when button #1 (loaded page) is clicked to stop the setInterval() and append a new div (position absolute) until button#2 (on the apended div) is clicked then to restart it. .. comprende?

Here is my “base” code

This is the action from the first button

 $('.replybutton').live('click',function(){
    $('.discussion').append('<div class="replyarea">some content in here plus "button number2</div>');
    });

This loads the page – initially

$('.discussion').load('board2.php');

And this is the refresh function

var auto_refresh = setInterval(
function()
    {
    $('.discussion').fadeOut().load('board2.php').fadeIn();

    }, 10000);

Failing anything – (but NOT preferred) I could use a toggle on the loaded page rather than the append used in the $('.replybutton').live('click',function(), but would still need to stop the refresh and restart it – based on the toggle, but I stress the toggle idea is not the preferred way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:21:31+00:00Added an answer on May 19, 2026 at 11:21 am

    I created an example for you at JSFiddle. Check it out here: http://jsfiddle.net/7YYV7/.

    Code

    var intervalId = 0;
    intervalId = setInterval(fadeDiscussion, 3000);
    
    $(function() {
        $('input[name=click]').bind('click', function() {
            clearInterval(intervalId);     
    
            $('.discussion').append('<div class="replyarea">some content in here plus <input type="button" name="save" value="save"></div>');    
        });
    
        $('input[name=save]').live('click', function() {
             intervalId = setInterval(fadeDiscussion, 3000);   
        });
    });
    
    var i = 1;
    function fadeDiscussion () {
        console.log(i);
        $('.discussion').fadeOut().fadeIn();
        i++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi folks this is prob quiet simple but not sure how to do it.
Folks, Apologies if this has been covered in another thread, but I have searched
I'm not sure which Stack Exchange site this would be best suited to so
I’m not sure this is the best example, but here goes. Let’s say I
folks! I have project in cc.net and this project nay start by 3 ways
Folks I am surprised to see my code working, that I dont have any
Folks I have a sealed class as follows. I want to extend this sealed
I understand that the best way to deploy a rails site is with passenger.
Update: Turns out that this problem was because half my mongrel did not restart.
I have to create an 'X' that pops up over the top right div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.