April 18, 2011
Copy certain text from one div into another div
Question by Paul
I want to be able to copy certain text from one div into another div.
The text is generated from a WordPress Plugin, and it generates 2 different divs, with the following classes 1 called .voting inactive and the second one called .voting.
The text generated is rating based is it will look something like: Rating 4.5/5, i ONLY want to take the 4.5 or whatever vote is generated and copy that into a div to display the result nicely.
Any help would be great.
Answer by Starx
An example
HTML
<div id="this">Sometext</div>
<div id="that"></div>
Script
$(document).ready(funtion() {
$("#that").html($("#this").html());
});