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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:27:07+00:00 2026-06-10T07:27:07+00:00

I have never met this bug before , whenever my jquery script gets to

  • 0

I have never met this bug before , whenever my jquery script gets to compare the numbers 9 and 10 or 99 and 100 or 999 and 1000 with 9<10 or 99<100 or 999<1000 I get a faulty result , I get false instead of true.
How do I fix this jquery bug ?
Thank you.

Jquery:

interval = setInterval(function(){
                $.post('help/retrivetable.php', { tableimpulse : sessid } , 
                    function(watchaget) {
                        if (countcom < watchaget)
                        {
                            countcom = watchaget;
                            $.post('help/retrivetable.php', { newtableimpulse : sessid } , 
                                function(getit) {
                                    $("#chat").append("<p id="+countmsg+">"+getit+"</p>");
                                    var scrolldown = $('#chat')[0].scrollHeight;
                                    $('#chat').animate({scrollTop:scrolldown}, 200);
                            }); 
                        }
                }); 
            }, 50); 

When countcom = 9 and watchaget = 10 it should enter that if , but I treats it like they are equal and won’t get in it.

  • 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-10T07:27:08+00:00Added an answer on June 10, 2026 at 7:27 am

    jQuery is Javascript. If it is a bug, it is not a jQuery-Bug but a Javascript-Bug. (Edit: There is a discussion on this sentence. Read the comments)

    Try this solution:

    The variables are defined as strings:

    var a = "9";
    var b = "10";
    

    This comparison will reproduce your result:

    if (a < b) ...
    

    When you compare two strings with the operator < you get true if the first operand will be sorted lexically before the second. You get this result, because in the lexical order a string starting with “1” will be sorted before a string starting with “9”, regardless of its length.

    Try this instead:

    if (a-b < 0) ...
    

    The term a-b forces javascript to process a numeric calculation. Strings will be converted into numbers.

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

Sidebar

Related Questions

I met strange problem. I have never work with Devise gem before. So, i
I have problem I have never met before. I was clearing yesterday clients db
I have never used jQuery before and I'm trying to do something really simple
I have never saved and retrieved an image to and from the database before.
I have never programed in bash before. I am reading all the files that
I have never used Foxpro before. Can you convert the following Foxpro code into
I have never come across this issue but most recently I noticed that a
I have never made a blog before. I am proficient with html and css.
I will try to make this simple and quick.. I have never attempted this
i have never worked with MKMapView or CoreLocation before so I need some help.

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.