html list <ol> breaking when user presses enter -


i have contenteditable div element contains list using <ol>. if user selects somewhere else not <li> new <li> item not created. if user presses enter twice after creating list no <li> item created.

how force lines in div element <li> item?

i dont have fiddle account if add contenteditable tag example here can see/test in action http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_lists

the effect of contenteditable varies browser, behavior described in question common when list inside editable area, rather declared editable element. reason appears since enclosing element editable, implementors thought there should way out of list, e.g. add content after it.

if change single contenteditable block like

<div contenteditable> stuff <ol><li>test</li></ol> other stuff </div> 

to 3 such blocks,

<div contenteditable> stuff </div> <ol contenteditable><li>test</li></ol> <div contenteditable> other stuff </div> 

then behavior changes: hitting enter twice in list adds empty item there.

but there problem <ol contenteditable>: seems make ie 9 omit list number (or ul list bullet), no apparent way make put there. (edit: happens in quirks mode. bug may present in earlier ie versions in different modes. recommend using contenteditable on wrapper element rather list elements ol directly.)


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -