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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:13:29+00:00 2026-06-11T18:13:29+00:00

my problem sounds pretty simple. I have divs with no id and class specified

  • 0

my problem sounds pretty simple. I have divs with no id and class specified like this

<div style="position:relative; float:left">
    <input type="text" onfocus="renderCalendar(event);" size="50" id="cal" name="cal">
    <div class="wrappercal calwrapper">
        <div class="yearmonth">
            <table class="caltable"><tbody>
            <tr><th width="80%" scope="col" colspan="5">
                <select class="dtcombo year" onchange="changeCalendar()">
                    <option value="2000">2000</option>
                    <option value="2001">2001</option>
                </select>&nbsp;&nbsp;
                <select onchange="changeCalendar()" class="dtcombo month">
                    <option value="1">1</option>
                    <option value="2">2</option>
                 </select></th>
              </tr>
              </tbody>
              </table>
         </div>
     </div>
</div>

There may be several similar divs in the page

I have a javascript function

function renderCalendar(event){
    var triggerer=event.target.id; // THIS WILL GIVE THE ID OF TEXTBOX THAT TRIGGERED THIS FUNCTION.
  $("#"+triggerer).parent().children(".wrappercal").children(".yearmonth").children(".caltable").children(".year").val(); //not working
}

The nest follows like this

  Parent Div > wrappercal(div) > yearmonth(div) > caltable(table) > year(select)

my problem is to get value of combo with class “year” of the parent div of textbox that triggered the function.

Can anybody figure out where i went wrong? any suggestions?

P.S. Please bear I m not good with dom elements.

Thanks

  • 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-11T18:13:30+00:00Added an answer on June 11, 2026 at 6:13 pm

    Why not try this?

    function renderCalendar(event){
        $(event.target).parent().find(".wrappercal .yearmonth .caltable .year").val(); 
    }
    

    Can you check (using console.log(event.target) and tracking) that the target element is really what/where it should be?

    EDIT

    The problem is that children() only searches through one level (deep) of child nodes and there is multiple levels between .caltable and .year (<tr><th>...). Use find() instead (which will search recursively through your nodes). 😉

    See this for more info.

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

Sidebar

Related Questions

This sounds like a problem many others have posted about, but there's a nuance
I am new to JS and I have a pretty simple-seeming problem. I want
This sounds confusing but isn't. Here is the problem: application is hosted at www.site.com/app
I need to calculate the net total of a column-- sounds simple. The problem
I have an event when fired does this: htmlView.DocumentText = contentArea.Text; The problem is
Ok, this sounds super simple!! but its driving me crazy and giving me brain
My question sounds pretty weird, but my problem is that I don't know how
I am pretty new to XNA, and I have been trying to figure this
I am pretty sure this is a straightforward problem I must be confused about
I am using Xcode 4.3 and i have a problem with playing sound... I

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.