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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:32:38+00:00 2026-05-18T08:32:38+00:00

I have about 8 text inputs. They all get concatenated with PHP in the

  • 0

I have about 8 text inputs. They all get concatenated with PHP in the end, but for ease of use for the users, I broke it up into multiple “questions”.

The fields all end up getting concatenated and used in an SMS enviroment where there is a 160 character cut off. I need to count all 8 inputs with jQuery to show the users if they go over that 160 character mark.

I can obviously very easily do this with any number of character counting plugins out there, but they are all made with a single textarea in mind, not broken up into multiple inputs.

I started to build this using

var current_count = parseInt($('#chars-remain span').text());

var regex=/^[a-zA-Z0-9\s]+$/;
if(regex.test($(this).val())){
    var current_left = current_count - 1;
}

if (current_left <= 0) {
    $('#chars-remain span').addClass('outOfChars');
} else {
    $('#chars-remain span').removeClass('outOfChars');
}
$('#chars-remain span').text(current_left);

and the HTML something like

<p id="chars-remain"><span>160</span> Characters Remain</p>

But it doesn’t really work. If you use the Delete key, it still counts as a -1 to the total and there are a few other bugs.
Is there a way to use the above code and have it work or is there a plugin that does this that I can’t find or maybe someone has a better idea of what to try?

Thanks!!

/// * EDIT ** \*

My current jQuery is setup like this:

$('#form-edit-card input').live('blur keyup',function(e) { 
    $('#howto').hide(); 

    $('#in-firstName').text($('#first_name').val()).show();
    $('#in-lastName').text($('#last_name').val()).show();
    $('#in-titlePosition').text($('#job_title').val()).show();
    $('#in-company').text($('#company_name').val()).show();
    if($('#phone_number').val() != "") { $('#in-officePhone').text("o: "+$('#phone_number').val()).show(); }
    if($('#mobile_number').val() != "") { $('#in-mobilePhone').text("m: "+$('#mobile_number').val()).show(); }
    $('#in-emailAddress').text($('#email').val()).show();
    $('#in-website').text($('#website').val()).show();

});

This allows me so that as the user types in the fields, it shows an example of what the SMS will look like in a box off to the side. So if I try to use K4emic’s answer then it pretty much works for the most part, but on the Office Phone and Mobile Phone it automagically adds the ‘o: ‘ and ‘m: ‘ so I need some way of gathering those three extra characters as well.
Maybe it would make more sense to count the characters of the paragraphs after the input writes to them so that the automagically added characters would be counted as well?

  • 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-18T08:32:38+00:00Added an answer on May 18, 2026 at 8:32 am

    This seems to do the trick!

    $('#form-edit-card input').live('blur keyup',function(e) { 
        $('#howto').hide();
    
        $('#in-firstName').text($('#first_name').val()).show();
        $('#in-lastName').text($('#last_name').val()).show();
        $('#in-titlePosition').text($('#job_title').val()).show();
        $('#in-company').text($('#company_name').val()).show();
        if($('#phone_number').val() != "") { $('#in-officePhone').text("o: "+$('#phone_number').val()).show(); } else{ $('#in-officePhone').text('');} 
        if($('#mobile_number').val() != "") { $('#in-mobilePhone').text("m: "+$('#mobile_number').val()).show(); } else{ $('#in-mobilePhone').text('');} 
        $('#in-emailAddress').text($('#email').val()).show();
        $('#in-website').text($('#website').val()).show();
    
        var count = 0;
        $('p.count_me').each(function(i){
            count += $(this).text().length;
        });
        $('#credits-remain span').text(count);
        $('#character_count').val(count);
    
        if (count > 120) {
            $('#credits-remain span').addClass('lowChars');
            $('#credits-remain span').removeClass('outOfChars');
        } else if (count > 140) {
            $('#credits-remain span').addClass('outOfChars');
            $('#credits-remain span').removeClass('lowChars');
        } else {
            $('#credits-remain span').removeClass('lowChars');
            $('#credits-remain span').removeClass('outOfChars');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with .Net grid view with about 12 text fields per
I have a text file of URLs, about 14000. Below is a couple of
I have to align a textbox and some text, at about 30 degrees, like
So I have about 10 short css files that I use with mvc app.
At my house I have about 10 computers all different processors and speeds (all
My question is about memory use and objects in actionscript 2. If I have
I have about 150 000 rows of data written to a database everyday. These
I have about 200 Excel files that are in standard Excel 2003 format. I
I have about 10million values that I need to put in some type of
I have a Server 2003 box with about 6 sites that each have about

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.