I'm really new to Javascript (but not programming). I have two ready-made functions in my page that work well separately:
- One changes the font size in some
<p>element. - Another magically breaks the
<p>element into lines, and wraps each line (as seen in the current browser display) with a<span>. This way I can highlight the line above which the pointer hovers.
When using the first function to increase the font size (say, click a button), the whole line structure changes and the <span>s are no longer in the right places.
So basically I want my font-size increasing button to first "undo" the action of the second function.
My question is whether I'll have to manually write a function that undoes the line breaking of the paragraph (removes the <span>s), or maybe Javascript has the ability to restore the page to a point before the function was called?
ctrl+zfunctionality. Otherwise, you're likely to get a lot of the @MattGreer comments.cloneNodeis probably what you're looking for.