Printing Div with Jquery, but don't print it all
<p>I'm using this script, found on StackOverflow, to print a div with all contents.  </p>

<pre><code>&lt;script&gt;
$(document).ready(function(){
    $('#printmodal').click(function(){

        // variables
        var contents = $('#content').html();
        var frame = $('#printframe')[0].contentWindow.document;

    // show the modal div
    $('#modal').css({'display':'block'});

        // open the frame document and add the contents
        frame.open();
        frame.write(contents);
        frame.close();

        //Hide all 'noprint' elements
        $(".noprint").css("display","none");

        // print just the modal div
        $('#printframe')[0].contentWindow.print();

        // hide the modal div
        $('#modal').css({'display':'none'});
    });
});
&lt;/script&gt;
</code></pre>

<p>However, there are some elements I don't want to print, ie; buttons and such.  For these elements, they have been given the classname of 'noprint'.  I have a media="print" css, but using the above function does not work.  noprint elements are still printing.  I tried adding the $(".noprint").css("display", "none"); function, but it still prints those elements.  Does anyone know of a way I can make certain elements not print while using the above function?</p>
