I'm trying to accomplish this:
But one Use an iframe with Textaria, designmode = 'on'
This does not seem to work = /
var editable = $ (document.getElementById ('edit'). ContentWindow .document); Editable.attr ('designmode', 'on') keyboard (function () {var length = $ (this) .find ('body') children ('br, p, div') length; if ($ ( This) .fund ('body') .html () length and length!) {Length = 1;} $ ('# lc'). Text (length);});
The behavior of different browsers tested here:
- Firefox 3.6 :
& lt; Br / & gt; The
tag has been added to make a line break. Initially, any& lt; Br / & gt;
, after breaking the first line, the current cursor is added before the position and - chrome :
is used to include each line & lt; Br / & gt;
The first line is used for blank lines - IE 8 compatibility :
& lt; P & gt;
is used to include each line
Lesson: Do not use contentEditable
or designMode
! The behavior of such cases is extremely incompatible and is quite useless. Of course you can use hacks to get around this, but what happens when new browsers come in? You have to maintain it till the end of time!
Comments
Post a Comment