I am trying to do a RTE where in i have a text embedded in a span element.I dont want the span tag to break when user hits enter on it. Here is what i have done


if (event.keyCode==13)
var sel = document.getSelection();
var anchor_node = sel.anchorNode;
var parent_node = anchor_node.parentNode;

if (parent_node.nodeName == 'span' )
var range = sel.createRange();
//now the cursor is out of span and hence shouldn't break it..

but it is not working.I am not sure whether this is possible.Basically what i am trying to do is to get the cursor out of span before when enter is pressed and hence assuming it will not break the span.Any comments?