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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:09:53+00:00 2026-05-23T08:09:53+00:00

Hopefully I can explain what I’m looking for… I’ve got two text boxes: Length

  • 0

Hopefully I can explain what I’m looking for…

I’ve got two text boxes: Length and Width

In one box the max value is 200 while in the other it’s 100. At the moment I’m using this code:

document.getElementById('Length').onchange = function(){
      if(this.value > 200){
           this.value = 200;
      }
      if(this.value < 10){
           this.value = 10;
      }
}


    document.getElementById('Width').onchange = function(){
      if(this.value > 100){
           this.value = 100;
      }
      if(this.value < 20){
           this.value = 20;
      }
}

Here’s the tricky part: I would like it to not be set which box has which max value. That should depend on what the customer types.
If someone types a value of under 100 in Length, then Width’s max is the 200. But if someone types “158” in Length then Width’s max should be the 100 and Length’s max is the 200. And Vice versa.

Also, if someone first types 150 in Length and then types 160 in Width, then the 250 in Length should be changed to 100 – so the 200 max value should belong to the box that’s most recently has a value higher than the 100 max.

Edit: Also, would it be possible to have the max values to be connected with a minimum value? So the box that gets the 200 max also has a 10 minimum and then the other box has the 100 max and the 20 minimum.
Hope that’s understandable.

  • 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-23T08:09:53+00:00Added an answer on May 23, 2026 at 8:09 am

    Something like this, perhaps:

    var length = document.getElementById('Length'),
        width = document.getElementById('Width');
    
    length.onchange = function() {
        var maxValue = width.value < 100 ? 200 : 100;
        if (this.value > maxValue) {
            this.value = maxValue;
        }
        if (this.value < 10) {
            this.value = 10;
        }
    };
    
    width.onchange = function() {
        var maxValue = length.value < 100 ? 200 : 100;
        if (this.value > maxValue) {
            this.value = maxValue;
        }
        if (this.value < 10) {
            this.value = 10;
        }
    };
    

    jsFiddle.

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

Sidebar

Related Questions

I'm new to WPF and data binding so hopefully I can explain the problem
Sorry for the unhelpful title, but hopefully I can explain this well enough. Lets
Hopefully I can explain this well enough, but please let me know if more
Hopefully I can explain this to where it make sense, but I'm trying to
Let me explain my problem, and hopefully someone can offer some good advice. I
Hopefully I can explain what I am trying to accomplish. I have no problem
Hopefully I can explain this clearly enough. I have a table that displays some
Hopefully I can explain this well and hopefully I'm thinking the right way :)
Can someone (hopefully Rob) explain how to implement the new SubSonicRepository<> Pattern? I have
Hopefully I can explain completely providing real info To start with then we have

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.