I have some code on my page that looks like this:
<div class="img-center">
<img src="img-path.jpg" alt="alt-text" class="feature-image" />
</div>
I am setting up a Print Stylesheet and due to some javascript manipulation of the content (and possibly a bug in firefox) the img prints off center. The solution I am going to do is have the img inserted dynamically into another div that will show when printed but I do not know how to have jQuery read the img div and then copy it into the other div. The code example for the other div would be something like this:
<div id="feature-container-print">
<img src="jQuery inserted copy of above img-path.jpg" alt="alt-text" />
</div>
How is this done? Please provide an example.
I have some code on my page that looks like this:
<div class="img-center">
<img src="img-path.jpg" alt="alt-text" class="feature-image" />
</div>
I am setting up a Print Stylesheet and due to some javascript manipulation of the content (and possibly a bug in firefox) the img prints off center. The solution I am going to do is have the img inserted dynamically into another div that will show when printed but I do not know how to have jQuery read the img div and then copy it into the other div. The code example for the other div would be something like this:
<div id="feature-container-print">
<img src="jQuery inserted copy of above img-path.jpg" alt="alt-text" />
</div>
How is this done? Please provide an example.
Share Improve this question asked Jun 8, 2012 at 0:45 L84L84 46.3k59 gold badges181 silver badges259 bronze badges2 Answers
Reset to default 4$('#feature-container-print img').attr('src',$('.feature-image').attr('src'));
I believe this would work:
$('.feature-container-print img').attr('src', $('.img-center img').attr('src'));
$('.img-center img').hide();
$('.feature-container-print img').show();