Hello all,
I have been trying, without much success, to find a way to get the currently selected text (including HTML elements) in IE. More specifically, I am trying to find a way to create a Range() object of some sort in order that I may iterate through the DOM elements. I am trying to allow the user to select a block of text in the editor and add a 'condition' from a custom drop-down that I have created. My code would then iterate through all DOM elements and add appropriate attributes to each. For example if the user highlighted all of the following text (they wouldn't see the tags of course)...
<p>This is some Text.<p>This is a sentence</p></p>
... and selected "condition_1" from the dropdown I want the following to appear...
<p class="condition_1">This is some Text.<p class="condition_1">This is a sentence</p></p>
Any suggestion or code snippets would be greatly appreciated. I have spent this whole week trying to figure out this problem and am getting to the point where I starting to run in circles.
I have been trying, without much success, to find a way to get the currently selected text (including HTML elements) in IE. More specifically, I am trying to find a way to create a Range() object of some sort in order that I may iterate through the DOM elements. I am trying to allow the user to select a block of text in the editor and add a 'condition' from a custom drop-down that I have created. My code would then iterate through all DOM elements and add appropriate attributes to each. For example if the user highlighted all of the following text (they wouldn't see the tags of course)...
<p>This is some Text.<p>This is a sentence</p></p>
... and selected "condition_1" from the dropdown I want the following to appear...
<p class="condition_1">This is some Text.<p class="condition_1">This is a sentence</p></p>
Any suggestion or code snippets would be greatly appreciated. I have spent this whole week trying to figure out this problem and am getting to the point where I starting to run in circles.