Append before parent after getSelection()
- by sanceray3
Hi all,
I have one question. I try to develop a little WYSIWYG editor.
I would like create a <h1> button which allows me to generate a <h1> title (by clicking on button after text selection in <p> element).
I obtain the selection with window.getSelection().... But now, I would like to put my append("<h1>my text selected</h1>") just before the <p>. It’s my problem, because my <p> elements don’t have id or class. So do you know a means to put my append just before the <p> where my text has been selected?
I don’t know if with my bad English you’ll understand me!
Thanks very much for your help.