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 7990337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:58:43+00:00 2026-06-04T12:58:43+00:00

I have a working checkbox reminder script: http://mauricederegt.nl/test/index.html It simply remembers the checkbox status,

  • 0

I have a working checkbox reminder script: http://mauricederegt.nl/test/index.html

It simply remembers the checkbox status, so when you come back to the webpage later, it will still be checked to unchecked. This works all great.

Now I need to dynamically load a php page in my HTML page (the original php page gets some stuff out of my database and displays a list of names. Underneath that list, this checkbox appears, followed by another list from the db).

I’ve placed the checkbox in the php file, but it will be shown in the HTML file when the php file is loaded. The js file is still loaded in the HTML file (also tried loading it in the php file, but this had no effect).

PROBLEM: The checkbox isn’t remembered anymore 🙁 See this demo: http://mauricederegt.nl/test/index2.html

I think this is because the page is dynamically loaded now and isn’t visible in the HTML?

How can I fix this, so the checkbox is remembered again?

Please see the source code of the HTML files for the js code if needed (is too much to post here)

Kind regards,

the php code:

   <?php  
$q=$_GET["q"];
$checked = ($_GET['checked'] == 1 ) ? 'checked="checked"' : '';

if ($q == 1) {
echo '<ul>
        <li>Mike</li>
        <li>Peter</li>
        <li>Richard</li>
        <li>Quintin</li>
        </ul>
<div id="soundcheck" class="button blue"><input type="checkbox" value="Name" id="sound" '.$checked.' /><label for="sound"></label></div>
<ul>
        <li>Apple</li>
        <li>Banana</li>
        <li>Pineapple</li>
        </ul>';
}
?>
  • 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-04T12:58:45+00:00Added an answer on June 4, 2026 at 12:58 pm

    The problem is that the code to check and then set the remembered status for the checkboxes is only called when the page is first loaded (bound to the DOM ready event), and therefore isn’t called when you dynamically load content.

    Call this part of your existing code:

    $('div#soundcheck input:checkbox').each(function() {
        // on load, set the value to what we read from storage:
        var val = storedData.get(this.id);
        if (val == 'checked') $(this).attr('checked', 'checked');
        if (val == 'not') $(this).removeAttr('checked');
        if (val) $(this).trigger('change');
    });
    

    after dynamically loading your checkboxes, and that should fix the problem.

    Edit:
    You’ll need to add the above code to this section of your existing Javascript:

    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("scoreboard").innerHTML=xmlhttp.responseText;
            // add the above code here
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have working code of js, it shows different div for selected option. <html>
I have working registration script the only problem is that i do not know
Have been working on this question for a couple hours and have come close
I have a checkbox column, and it is working just as intended. How do
I'm working on an email series signup form that needs to have a checkbox
I have the following jQuery script to transform a checkbox into a jQuery-UI button
I have an AccountAuthenticator and associated SyncService that are working when I test via
I have created a validation with two checkbox. both validations are working fine with
I am working on struts2. I have 3 checkbox in my jsp page (say
It seems hard to just have a link working inside a checkbox label, overriding

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.