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());
});

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!