Okay!... I'm facing this for hours now...
html
<div contenteditable="true" style="width: 509px; "></div>
<textarea cols="50" rows="10"></textarea>
jQuery
$('div').keyup(function(){
$('textarea').val($(this).text());
});
$('textarea').keyup(function(){
$('div').html($(this).val());
});
I want it that whatever I type in the <div>, would look as is in the <textarea> and vice versa... but I'm stuck... please see my Fiddle for what I mean...
for the reason is that, I'm using <div> as a replacement for <textarea>... because <div>'s scrollbar is easy to customize than of the <textarea>... but if you can see, contenteditable div would include another div when you press enter...
edit what's happening is,
in the div,
I
am
crazy.
but
your
way
of
coding
is
worst.
but in textarea, using .html()
in div
I<div>am</div><div>crazy.</div><div>but</div><div>your</div><div>way</div><div>of</div><div>coding</div><div>is</div><div>worst.</div>
.text() is like this
I am crazy. but your way of coding is worst.
and really, I don't want that...