I have a WYSIWYG editor working in all browsers except IE (all versions). I have a problem with the function below:
function tag(tag) {
var range = window.frames['textEditor'].getSelection().getRangeAt(0);
var newNode = document.createElement(tag);
range.surroundContents(newNode);
}
Any ideas on how to fix this?
IE doesn’t support range, because it’s a big baby. However, it will do what you want, but with separate logic. Check out the Quirksmode Range Page for info on how to whip IE into shape.