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 7190151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:27:10+00:00 2026-05-28T19:27:10+00:00

I am looking to find a way using jquery / html / or even

  • 0

I am looking to find a way using jquery / html / or even css to do the following.

My text area is fixed size, 1 font size/type, and I want to be able to do the following.

  • Limit number of lines to 18 lines
  • Display the number of lines the user has used so far (Kind of like twitter approach with characters but displaying lines used)

Line Definition: A line for my project is either when the user presses enter on the keyboard and goes to a new line, OR when a new row / line is created in the textarea by naturally typing continuously int he textarea. I basically have a fixed size textarea and the user cannot go outside these limits I set.

  • 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-28T19:27:11+00:00Added an answer on May 28, 2026 at 7:27 pm

    I will not provide any code snippets for your problem but just an approach of how i’m seeing the solution. Basing your algorithm on the font.js javascript library, you could retrieve the length in pixels of the text and of all the caracters in the text. If you’re using a unique font in your textbox you could know when a line is completed each time the number of pixels in a line equals or is inferior to the actual number of pixels used in a new line. In pseudo-code it would look like this :

    var textBoxLineInPixels = 300 //or getting the actual number through DOM;
    
    onChangeEvent    {
       var totalNumberOfPixels = getNumberOfPixelsFromElement(idToYourTextBox);
       var numberOfLinesUsed = totalNumberOfPixels / textBoxLineInPixels;
       update(idToYourNumberOfLinesContainer, numberOfLinesUsed);
    }
    

    Dividing the total number of pixels in your textarea by the the number of pixels in a line will give you the current number of lines used in your textarea.

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

Sidebar

Related Questions

Am using jquery and tabs based on http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery/ <script type=text/javascript> $(function() { $(.tab_content).hide(); //Hide
Using jQuery or straight Javascript, I'm looking for the best way to find the
I'm looking for a way to find out the URL of a SWF using
I have just using the jquery hover : $.each(navItems, function(i){ $(navItems[i]).hover(function(){ $(this).find('ul:first').css({visibility: visible,display: none}).show();
I was looking to find a way to use include statement using a fifo
I'm looking to find a way to access the .net query string contained in
I am looking to find a way to programatically (C++) control/secure access to the
I've tried to find a way to do this, but without success. I'm looking
I'm looking for a way to find the name of the Windows default printer
I'm looking for a way to find references to a web method in other

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.