Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1109019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:10:13+00:00 2026-05-17T02:10:13+00:00

Im trying to accomplish this: http://jsfiddle.net/WkVb9/ But instead of using a textarea, use an

  • 0

Im trying to accomplish this:

http://jsfiddle.net/WkVb9/

But instead of using a textarea, use an iframe with designmode = 'on'

http://jsfiddle.net/ysgEf/

It doesn’t seem to work =/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:10:14+00:00Added an answer on May 17, 2026 at 2:10 am

    Have a look at this piece of code:

    var editable = $(document.getElementById('edit').contentWindow.document);
    
    editable.attr('designMode', "on").keyup(function(){
        var length = $(this).find('body').children('br, p, div').length;
    
        if($(this).find('body').html().length && !length){
            length = 1;
        }
    
        $('#lc').text(length);
    });
    

    Here’s the behavior of the various browsers tested:

    • Firefox 3.6: <br /> tags are appended to form the line breaks. At the start, there’s no <br />, while after the first line break one is added before the current cursor position and one after
    • Chrome: <div> are used to contain each line. <br /> are used for empty lines. The first line is not wrapped
    • IE 8 Compatibility: <p> are used to contain each line.

    Lesson: Don’t use contentEditable or designMode! The behavior is horribly inconsistent and quite useless for cases like this. Of course you can use hacks to get around this, but what happens when new browsers come out? You’d have to maintain this till the end of time!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to accomplish something along the lines of this: http://devblog.jasonhuck.com/assets/infiniteformrows.html But... I
Wonder if anyone could shed some light on this http://jsfiddle.net/orbitalmedia/ZrxBb/7/ Basically I'm trying to
I am stuck with using Dojo to accomplish this. Basically what I am trying
I'm trying to accomplish the following using CSS: <table border=1 width=300px> <tr> <td rowspan=2>This
Please review the fiddle here for an example: http://jsfiddle.net/TKJsc/1/ Basically i'm trying to make
I been trying to follow the example on this page: http://grysz.com/2010/06/01/use-custom-fonts-in-jasperreports-pdf-exporter/ Still, when I
Here is the code: http://jsfiddle.net/GKBfL/ I am trying to get collection.prototype.add to return a
I'm trying to accomplish this using web.config and it worked fine when I had
I have a table that looks like this: http://jsfiddle.net/8SEz2/4/ Branch StSeq# Inv# Invoice Date
I'm trying to accomplish this: strcat('red ', 'yellow ', 'white ') I expected to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.