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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:20:27+00:00 2026-06-18T00:20:27+00:00

I have the following code to run on the rendered template page after selecting

  • 0

I have the following code to run on the rendered template page after selecting to print from the browser:

<script type="text/javascript">
$(function() {
    $("td:contains('Labour')").next("td").addClass("white");
    var thisTr = $("td:contains('Labour')").parent();
    thisTr.children().eq(2).addClass("white");
    thisTr.children().eq(3).addClass("white");
});
</script>

CSS:

 @media print {
      body           { margin:auto; }
      .section       { page-break-inside:avoid; }
      div#sfWebDebug { display:none; }
      .white {color: white;}
    }

I checked the code and it’s working when in a normal browser window: http://jsfiddle.net/elen/vArH8/

But the white class doesn’t seem apply in the pop-up to print. I tried in Chrome and Firefox.

Do browsers allow JavaScript to run when printing?


answering my own stupid question – it would help if I added jquery plugin to the template first!

and the following code works perfectly:

<script type="text/javascript">
$(document).ready(function() {
    var thisTr = $("td:contains('Labour')").parent();
    thisTr.children().eq(1).empty();
    thisTr.children().eq(2).empty();
    thisTr.children().eq(3).empty();
    window.print();
});
</script>
  • 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-18T00:20:28+00:00Added an answer on June 18, 2026 at 12:20 am

    This isn’t an issue of javascript, it’s just that printers don’t print white. It will often discard CSS to make things more readable.

    Do you want to just hide those fields? You can use the .empty() method to achieve that more easily.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE : I have the following code: <script type=text/javascript> function addScript(url) { var script
I have the following code I want to run, but the problem is $this->type
I have the following code for a jquery mobile page. When I run it
I have following code written to run NSTimer . But the NSTimer selector is
I have the following code being run if an iphone/ipad/ipod is detected: $('.tooltip-trigger').tooltip({offset: [20,
I have following code snippet that i use to compile class at the run
Let's say that I have the following code that's run in one thread of
I have the following code that fails when i run it. my .h file:
I have the following code here that won't run on ARC since it combines
I have the following code, which is run every 10ms as part of a

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.