javascript - prevent IE from wrap in P element in contenteditables -
suppose have contenteditable div
in page, when user starts type div
, ie wraps user input p
element, ff not
question how prevent ie behavior?
thanks
here's basic snippet task, can develope further.
function keydown (e) { var range = document.selection.createrange(); if (e.keycode !== 13) return; range.pastehtml('<br>'); e.cancelbubble = true; e.returnvalue = false; return false; } if (pad.attachevent) { pad.attachevent('onkeydown', keydown); }
the code using ie's legacy selection/range , eventhandling models, works in ies. can play code @ jsfiddle.
Comments
Post a Comment