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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:11:36+00:00 2026-06-03T22:11:36+00:00

I want to use a jQuery/JavaScript function to validate the input of a textbox.

  • 0

I want to use a jQuery/JavaScript function to validate the input of a textbox.

I have pairs of checkboxes like this:

<input type="text" id="MinMondayTxt" />
<input type="text" id="MondayTxt" />

this is for each day of the week (MinTuesdatTxt, MinWednesdayTxt…)

The Function is like this:

function ValidateTxt(TxtId){
}

It take the Id of a textbox as input. What I want to do is the following:

1) Check if the Id starts with “Min”

2) Get the corresponding textbox, by removing “Min” from the id. for example if we have MinMondayTxt I want to remove the “Min” in order to access the MondayTxt textbox

3) Compare the the values of the 2 textboxes (all values are numeric)

4) if MinMondayTxt > MondayTxt Alert the user

I am looking for help for step 1) and 2) : How can I check if the id starts with “Min” and how to get the corresponding textbox id (by removing the min)

  • 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-03T22:11:38+00:00Added an answer on June 3, 2026 at 10:11 pm

    You can use replace() method with the #id selector of jquery as below

    function ValidateTxt(TxtId){ 
     var withoutminid = TxtId.replace(/^Min/, '');
    
     var withouminidval = $('#' + withoutminid).val();
     var minidval = $('#' + TxtId).val();
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use jquery delegate to call a function, and this works fine:
I'm using jquery.validate plugin and facing the following situation: <form id=myForm ....> <input type=text
I already started this in javascript so I don't want to use jquery but
I have included jquery and jqueryui from google api as follows <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js></script>
I want to use javascript / jquery to determine if an xml file exists.
I was creating a countdown timer using javascript; I can use jQuery. I want
I have an asp.net user control on which I want to use jquery ajax.
I have a problem with jQuery Validator. I want to use required property on
i want to use jquery ui auto complete plugin in asp.net. this is my
I have a simple html option/select (dropdown) menu. I want to use JQuery to

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.