tags:

views:

34

answers:

1

I'll try to explain:

I have numerous div classes, but for the sake of simplicity, let's say I only have 3.

Someone is viewing DIV 1, and I want to give them the option of only printing DIV 1, omitting 2 and 3.

However, on the same page, I would like to give them the option to ONLY PRINT DIV 2. Or only print DIV 3.

I think I get how you can omit certain things from getting printed. But how can you select a section here or there on the same page to be printed with a print link.

Thanks, Tracy

A: 

You can use jQuery to show/hide divs. Read the jQuery tutorial:

http://docs.jquery.com/Tutorials

The code will look this way:

<script>
function showDiv(n) {
  $('.divs').hide();
  $('#div_'+n).show();
}
$(document).ready(function() { showDiv(1); });
</script>
<a href='javascript:showDiv(n)'>show div n</a>
<div class='divs' id='div_n'>I'm div n</div>
milosz
Yes, I am aware of how to show/hide divs, but how do you print specific divs?
flipflopmedia