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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:11:05+00:00 2026-06-14T20:11:05+00:00

My goal is to get all the HTML on a page except those which

  • 0

My goal is to get all the HTML on a page except those which checkboxes are unchecked and post it to a script.

I do this by having checkboxes with a value which is a class on an element. For example my checkbox is in a row on a table and that …

All the content I want is inside #page_content. As the content isn’t aware of it’s container – that is the checkbox doesn’t know it’s inside of the table so can’t wrap around it, I figured it’s easier to get everything on the page and just remove the elements that are unchecked. That way my markup is correct.

I am using jQuery to do this, but I don’t know how to approach it correctly. The way I have in mind is to get all the unchecked checkboxes and store their values into a variable ‘unchecked’.

I have an outerHTML() function that can get me the element and it’s html.

Then I

$('#export').click(function(e) {
        e.preventDefault();
        var uc, unchecked = [], html;
        $('input:checkbox:not(:checked)').each(function() {
            unchecked.push("." + $(this).val());
        });
        uc = unchecked.join(',') + ",.actions,input,button,.btn";
        console.log(uc);
        $('#page_content').find('*').not(uc).each(function() {
            html += $(this).outerHTML();
        });
        console.log(html);
        // $('#export-data').val(html);
        // console.log($('#export-data').val());
    });

Then by the end of it I have this string of all the HTML.

Update: Worked a bit more on it, I get something but it’s mixed tags. Also I want to stript out inputs and buttons and other classes so I think I’m doing it right but the output has many duplicates. Hmmm….

  • 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-14T20:11:05+00:00Added an answer on June 14, 2026 at 8:11 pm

    Ok using my method I found it clearer and more jquery-ish 🙂

    var filter, html, el, unchecked = [], additional, elements;
    $('input:checkbox:not(:checked)').each(function() {
        unchecked.push("#" + $(this).val());
    });
    // We remove checkboxes, cb colums, inputs, etc
    additional = ".actions,input,button,.btn,textarea,.cb";
    if (unchecked.length) {
        filter = unchecked.join(',') + "," + additional;
    } else {
        filter = additional;
    }
    var $elements = $('#page_content').clone();
    $elements.find(filter).remove();
    html = $elements.outerHTML();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to count all word in html page as well as count
Goal: Get a specific HTML element ul's id value from a ul class called
My goal is to get various SEO-relevant information for various sites. Basically all the
My goal is to get a Time instance from a DateTime instance This has
How do i do that? Actually my main goal is to get which checkbox
Hello all! This is my first post on stackoverflow. After hours of searching and
I just want to get a part of an website within all the html-tags:
Goal : Get a screenshot of a map with overlays(MKOverlayView) as well as the
Goal My goal is to to get Twitter Bootstrap to worth with my Play
The goal is to let users login via Twitter, get OAuth token and secret

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.