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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:36:53+00:00 2026-05-21T11:36:53+00:00

I have a form that outputs systems assigned to a project. The systems are

  • 0

I have a form that outputs systems assigned to a project. The systems are looped and new rows can be added dynamically so using ID attribute is not available.

When the user make a change to the status drop down option, I need the associated Status Effect Date field to become required. I don’t know how to traverse the DOM well enough to locate the field with a class of datepicker.

<tr>  
    <th class="form">
        <label>Status</label>
    </th>  
    <td>
        <div style="float:left;">  
        <select class='status' name="status" >  
            <option value="New">New</option>  
            <option value="Existing">Existing</option>  
            and so on...  
        </select>  
        </div>
    </td>  
    <th class="form">
        <label>Status Eff. Date</label>
    </th>  
    <td>
        <div style="float:left;">  
            <input type="text" name="statuseffective" class="datepicker" size="15" >  
        </div>
    </td>  
</tr> 

If spelled out, the process would work like this:
when a user make a change to the status, JS would find the next input field that contained the class .datepicker and addClass(‘required’) as well as set focus to this field (setting focus is optional since the addClass’required’ would already make the field red).

I can determine which drop down box changed, I just cannot get to the next input element. Any help would be appreciated.

  • 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-21T11:36:54+00:00Added an answer on May 21, 2026 at 11:36 am
    $('.status').change(function(){
        $(this).next('input.datepicker').addClass("required").focus();
    });
    

    Should do the trick.

    Update

    Ok so… because both do not have the same parent you have to go up a level. next only finds the direct next element, nextAll finds all of the elements (at the same dom level it looks like). Testing a bunch of different ways of doing it and came up with this:

    $('.status').change(function(){
        $(this).parents('td').nextAll("td:first").find('.datepicker').focus()
    });
    

    That should do the trick for ya!

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

Sidebar

Related Questions

I have a php script that handles a form input. For design reasons both
I have some fields in my ViewModel that I only need for the output
I have a PHP generated form which consists of a list of items, each
I have created two JSP programs as follows. First One: Addmulti.jsp <html> <head><title>Upload Excel
I have a strange problem with the <ui:repeat> tag. Even for my very simple
question relates to PHP and Javascript for now every table has a form with
I am getting 406 Not Acceptable error when submitting my form with jQuery. I
i have the following javascript file named coupon.js - jQuery(document).ready(function(){ jQuery('.appnitro').submit( function() { $.ajax({
I need help solving problem N from this earlier competition : Problem N: Digit
The problem: I am embedding a CSS file into a custom control library with

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.