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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:53:51+00:00 2026-05-13T18:53:51+00:00

How to set a max value for a text box in JavaScript? For example,

  • 0

How to set a max value for a text box in JavaScript?

For example, the value must be within 100. No greater value must be entered.

My task, I am using two text boxes where I am inserting marks.

The first text box my marks will be out of 80.

The second will be out of 20.

I am calculating the total of the 1st and 2nd mark and
the result will be in another text box. The mark for the third text box will be 100.

Now, my query is: how to set the maximum value for the values for mark 1 mark 2 and total as 80,20 and 100, respectively.

         mark1/80      mark2/20       total/100
qqq        80              20             100
  • 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-13T18:53:51+00:00Added an answer on May 13, 2026 at 6:53 pm

    Add onsubmit to the form and set to a custom function like onsubmit="return mycheck();".

    There you can get your textbox using document.getElementById() and their values with .value. To get a number just do var thenumber = new Number(document.getElementById('theid').value);.

    Then do whatever check you need with the number and return true if all it’s OK or false if it isn’t.

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

Sidebar

Related Questions

How would your determine a max value to set an alarm on the I/O
I know you can set max heap size at startup using -Xmx but is
How to set max image size and weight/height using Dragonfly? Max size will be
I have an input that I want to set the max value to 255.
I have a text box with autocomplete set and working perfectly fine. However when
I'm trying to set the maxlength on input fields dynamically using JavaScript. Apparently that
I'm wondering how to set the max possible time limit for a php page,
I have the following query: DECLARE @Region VARCHAR(MAX) SET @Region = '' SELECT @Region
So I am trying to use the CSS hack to set the max-height for
I set a variable MAX_REQUEST = 100 in settings.py I write a middleware which

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.