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

The Archive Base Latest Questions

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

I have forms generated by loop, so the name of elements would be the

  • 0

I have forms generated by loop, so the name of elements would be the same. That’s the reason i want to use $(this) inorder to access them and compare. But unsuccesful as of yet, any ideas how can I.
FYI I am a newbie to Jquery, any help appreciated 🙂

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">

$("form").submit(function() {

 if ($(this).children("#textbx").val() < $(this).children("#comparetobox").val() ) {

    $("span").text("Validated...").show();
    return true;


  }

    $("span").text("Not valid!").show().fadeOut(1000);
  return false;
});

</script>

<form id='userbid'  name='userbid'  method=post>
<input type="text" name="textbx" id="textbx">
<input type="text" name="comparetobox" id="comparetobox">
<span></span>
<input type="submit" value="save" name="submit">
</form>
<!-- Form is in loop so can be generated N no of times -->
<form id='userbid'  name='userbid'  method=post>
<input type="text" name="textbx" id="textbx">
<input type="text" name="comparetobox" id="comparetobox">
<span></span>
<input type="submit" value="save" name="submit">
</form>
  • 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:42:18+00:00Added an answer on June 3, 2026 at 10:42 pm

    I don’t know how you compare values of input boxes, but this is valid JavaScript code:

    $("form").submit(function() {
        if ($(this).children(".textbx").val() < $(this).children(".comparetobox").val()) {
            $(this).children("span").text("Validated...").show();
            return true;
        }
        $(this).children("span").text("Not valid!").show().fadeOut(1000);
        return false;
    });
    

    Pay attention that ID of elements should be unique. Use classes instead (e.g. .textbx).

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

Sidebar

Related Questions

I have a table that's generated by a normal PHP loop. What I want
I have a Tcl/Tk app that generates many forms and would like to be
I have a form with fields that are generated dynamically via a loop. It's
I have a form with some generated input fields like theese: <input value=March name=month[March]
I have a form that when submitted successfully generates new elements on the page
I have 3 HTML form inputs fields that is dynamically generated by a add
I have a form that is generated dynamically. The end users will be able
I have scheduled a repeating callback on every frame: [self schedule:@selector(nextFrame:)]; This forms my
I have the following HTMLHelper extension to create a submit button that would work
i have multiple form which will be generated 4 times with the same field

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.