Manipulate javascript range object with jQuery
Hi,
i'm trying to find out if a javascript range object can be manipulated with JQuery.
For instance if i wanted to retreive the current selection and then wrap it into a strong tag this is what i would do in javascript :
- var t = document.getSelection(); // i only put here the method for Firefox to keep the ex clean
- var newNode = document.createElement("strong");
- var range = t.getRangeAt(0);
- range.surroundContents(newNode);
Now, ideally i would like to work on the range object with jQuery so that it can become much easier and powerful. Something like $(range).wrap('strong') and so on...
Have i made my question clear?
Thanks for any info and congrats to the jQuery Team that makes our life much more easier!