Re: howto get HTML code from selection?
schnee <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
Forget this message and excuse me. I do get the HTML. My mistake... schnee wrote: > Hi, > I know this subject is almost 3 years old, but I'm looking for the same > solution, tried the patch, > and it doesn't work for me: still getting text with no HTML (FF 3.5) > Have you found another solution? > > [email protected] wrote: >> Big thanks! >> """Martin Honnen wrote: >> """ >>> Kind of a hack but in a HTML document you can do e.g. >>> >>> var selection = window.getSelection(); >>> var range = selection.getRangeAt(0); >>> if (range) { >>> var div = document.createElement('div'); >>> div.appendChild(range.cloneContents()); >>> alert(div.innerHTML); >>> } >>