Wednesday 15 September 2010

javascript - Moving text from one to another by clicking a button -


What I want to do is this:  Enter the image details here

I can either add all the words to the left to and lt; Div & gt; Correct & lt; I want to move to div & gt; or click to highlight only the ones selected is already part of the click but the content is a & lt; Div & gt; to the other side which I have never done before? Is there anything that can be done with jquery or javascript? . Thank you.

There's not much to go here, but I'm guessing highlighting thing that lesson A square that is inside a div, you can do something similar with jQuery:

  $ ("body"). ("Click", "#copyselected", function () {var text = ""; $ ("div .highlighted") each (function () {text + = $ (this) .text (); $ ( "Textarea"). Val (text);})}) $ ("body") ("Click", "#copyAll", function () {$ ("textarea"). Val ($ ("div"). Text ());})   

You obviously need to change the selectors to match your markup.

Here's a fiddle:

No comments:

Post a Comment