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

  • Home
  • SEARCH
  • 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 7194469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:22:41+00:00 2026-05-28T20:22:41+00:00

My counter function looks like that function count() { var value = ids.val(); return

  • 0

My counter function looks like that

function count() {
    var value =  ids.val();
    return (value == '') ? 0 : value.replace(/\s,?|,$/g, '').split(',').length;
}

Then checking for returned value and posting data via ajax

if(count() === 10){   
    ajaxPost();     
    $(ids).val('');
}

I set interval to use this function. Noting that, tried all other function like change(),paste().. the only way that worked with my scanner device is, to set interval.

The problem is, when i type 9 numbers, like 1…9 and then want to type 10, when I press 1 to write 10 right after 9, it directly posts data. doesn’t wait for “,”. How can I modify it to wait for “,” after last (in this case 10th) word?

  • 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-28T20:22:42+00:00Added an answer on May 28, 2026 at 8:22 pm

    You can check the key pressed and see if it is a comma, then only run your code after it is known that the last key entered was a comma:

    $(ids).on('keyup', function (event) {
        if (event.which == 188) {
            if (count(this.value) === 10) {
                ajaxPost();     
                ids.value = '';
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a counter hash that I am trying to sort by count. The
So I have some code that looks like this: int a[10]; a = arrayGen(a,9);
I'm tasked with creating a progress bar (actually, a timer that looks like a
So I have a simple form-extension script: var counter=1; function newField(counter) { counter++; var
So, I am seeing a curious problem. If I have a function // counter
How to get a counter inside xsl:for-each loop that would reflect the number of
I'd like to be able to output a letter in the same way that
Using PHP , I would like to make a while loop that reads a
Season's greetings! I have a function that prints out the contents of a char**
I have a function that processes a large image. By the specification, the largest

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.