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

  • Home
  • SEARCH
  • 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 8375101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:05:12+00:00 2026-06-09T15:05:12+00:00

I have a page that the function is to refresh div tag. Div tag

  • 0

I have a page that the function is to refresh div tag.
Div tag function is refresh the data will receive.

So far that’s ok.

When I block the text using mouse, that’s will clear the block text based on timing “20000”. This below the JS script function.

<script src='js/jquery.min.js'></script>
<script>
    $(document).ready(function()
    {
        $("#content2").load("post_rf.php");
        var refreshId = setInterval(function()
        {
            $("#content2").load('post_rf.php?randval='+ Math.random());
        }, 20000);
        $.ajaxSetup({ cache: false });
    });
    </script>

What I want to do is, how to keep the block text in div refresh function ?
Because some user maybe want to copy the text. In this case, user must quickly copy the text before div refresh.

Maybe the example like facebook post live update.

  • 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-06-09T15:05:14+00:00Added an answer on June 9, 2026 at 3:05 pm

    You want to assign your interval to a variable, when user mouse overs your DIV then use clearInterval, when mouse out setInterval again.

    var interval;
    
    $(div).bind("mouseout", function() {
        interval = setInterval(refresh, 1000);
    });
    
    $(div).bind("mouseover", function() {
        clearInterval(interval);
    });
    

    EDIT

    Sorry I posted that on a phone and it’s hard to write code that way, try this:

    <script src='js/jquery.min.js'></script>
    <script>
        $(document).ready(function() {
            $("#content2").load("post_rf.php");
    
            // set your initial interval to kick it off
            var refreshInterval = setInterval(function() {
                $("#content2").load('post_rf.php?randval='+ Math.random());
            }, 20000);
    
            // bind an event to mouseout of your DIV to kickstart the interval again
            $("#content2").bind("mouseout", function() {
                refreshInterval = setInterval(function() {
                    $("#content2").load('post_rf.php?randval='+ Math.random());
                }, 20000);
            });
    
            // clear the interval on mouseover of your DIV to stop the refresh
            $("#content2").bind("mouseover", function() {
                clearInterval(refreshInterval);
            });
    
            $.ajaxSetup({ cache: false });
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function in jQuery that gets data from a page with POST,
I have a div which is centred on the page that contains text loaded
I have a page that uses another page via the include() function. The page
I have a page where the visitor initiates a function that executes click() on
I have a function that counts the amount of visits a page has, and
I have a function that I use on index.php page and I would like
I have some jQuery code that intercepts links clicked on a page: $(document).ready(function() {
I have a form with one text box that is part of a div
I have a page in which I have a div. The content from that
I have the following jQuery function that I'm using to display a timer on

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.