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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:02:39+00:00 2026-05-31T21:02:39+00:00

hi im new to jquery and im facing these problem i have these code

  • 0

hi im new to jquery and im facing these problem

i have these code

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> 
<script>
$(".adults").change(function(){
    var test = $(".maxpeople").val();
    if ($(this).val() > $(".maxpeople").val()) {
        alert("test");
    }
    alert(test)
});
</script>

and i need to compare the digits and if the value of .adults is bigger than the value of .maxpeople then show me an alert.
the code works but it looks like it only takes one digit.
exjample:

.maxpeople = 17

i put 1 in .adults and is ok but if i put 2 it shows the alert, now if i put 16 it doesnt show the alert.. what im i doing wrong??

  • 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-31T21:02:40+00:00Added an answer on May 31, 2026 at 9:02 pm

    val() is going to return a string. If you want to compare numbers, you will have to convert the strings to numbers.

    Assuming you just want integers, use parseInt.

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

Sidebar

Related Questions

I'm having a problem with the following code. Below is my javascript <script type=text/javascript><!--
I'm kind of new to JavaScript and jQuery and now I'm facing a problem:
I am relatively new to using jQuery and I have a problem with creating
I am facing a new kind of problem. I am using the jQuery to
I'm new to jQuery and am facing now a weird problem. I succeeded to
I have a jQuery slider rotation here: http://8wayrun.com/ Every 5 seconds, the slide changes.
I facing a weird problem here. I already have a simple try-out for jquery
I'm currently working on a new Magento template, and I'm facing problems with jQuery.
Using jQuery UI 1.8rc3 combined with the new jquery.effects.fade.js code, I've been able to
I have application that brings response via Ajax and creates 5-20 new jQuery click

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.