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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:35:18+00:00 2026-06-09T03:35:18+00:00

I am counting how many profile field items are empty and dispalying the count

  • 0

I am counting how many profile field items are empty and dispalying the count as a label. If all fields are complete it will display a tick instead of the count (0).

Like this

$(function() {
    var num = $('input[name^="p-"]').filter(function(){
        return !$(this).val();
    }).length;
    if (num > 0) {
    $('.Personal').prepend('<span class="label label-important" title="<?php _e('Incomplete'); ?>">'+num+'</span>');
    } else {
    $('.Personal').prepend('<span class="label label-info" title="<?php _e('Completed'); ?>">&#10004;</span>');
    }
});

I want to update it so that the count is updated as each field is completed, so you will see it count down as you complete the fields.

What is the best way to achieve this?

  • 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-06-09T03:35:20+00:00Added an answer on June 9, 2026 at 3:35 am
    $('input[name^="p-"]').on('change',function(){
        var num = $('input[name^="p-"]').filter(function(){
            return !$(this).val();
        }).length;
        if (num > 0) {
        $('.Personal').prepend('<span class="label label-important" title="<?php _e('Incomplete'); ?>">'+num+'</span>');
        } else {
        $('.Personal').prepend('<span class="label label-info" title="<?php _e('Completed'); ?>">&#10004;</span>');
        }
    });
    

    If you want to select textarea as well modify the selector like so

    $('input[name^="p-"], textarea').on('change',function(){});
    

    You can, of course, apply [name^="p-"] to it as well, if you wish

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

Sidebar

Related Questions

I am counting words in a text field and after a certain amount of
I'm counting the right answers field of a table and saving that calculated value
i have this code for counting how many digits where entered var tnnod=0; function
Is there any portable (Windows & Linux) way of counting how many milliseconds elapsed
I have a table: Hourly_Sales that is like this (counting how many buy something
The latest version of XCode supports reference counting. However many older libraries are not
my question is regarding a left join I've tried to count how many people
How to query to get count of matching words in a field, specifically in
Many times I find myself counting occurrences with Tally[ ] and then, once I
I am counting how many seconds it takes to go from aspx page 1

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.