javascript - jquery change different text in divs -


Hello,

I have three separate divs and one paragraph in each of them

I would like to click on div 1 and text 1 changes - if I click on div 2, we make changes in text 2, while text 1 is changing back to normal ...

Should just change the Div in the text where I should just click since I am a newbie for jquery, I can only achieve that all texts are changing, but not even one.

Who can help me?

Thank you!

This will do the trick - first populate the data for each div for the original detect, then click The event that sets everything back to original data, and sets itself in new text:

  $ ('div'). Each (function () {$ (this). Data ({original: $ (this) .text ()})}) $ ('div'). Click (function () {$ ('div'). (Function () {$ (this) .text ($ (this) data ('original'))} $ (this) .text ('new text ')})    

Comments