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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:40:49+00:00 2026-06-14T15:40:49+00:00

This really sounds simple, so i’m not sure where am I stuck. I have

  • 0

This really sounds simple, so i’m not sure where am I stuck.
I have a form which I manually validate. after I check the radio buttons to be as required, I need to get the label above this element.
Here is the HTML. I cannot change the markup as this code is an inheritance and part of a bigger process.

So this is my HTML:

<label>Do you market on? : </label>
<li>
    <label>Plenty of Fish:</label>
    <span href="#" style="float:  left; margin-right: 10px;">
        <input type="radio" class="required" name="data[SignupAnswer][100][answer]" value="yes" />Yes
    </span>
    <span href="#" style="float: left; margin-right: 10px;"> 
        <input type="radio" class="required" name="data[SignupAnswer][100][answer]" value="no" />No
    </span>
    <input type="hidden" name="data[SignupAnswer][100][signup_question_id]" value="100">
    <input type="hidden" name="data[SignupAnswer][100][class]" value="bool">
    <input type="hidden" name="data[SignupAnswer][100][required]" value="0">
    <input type="hidden" name="data[SignupAnswer][100][question]" value="Plenty of Fish">
</li>

I find the first radio, and then I need to find the label above it called “Plenty of Fish”.

I tried with .prev(), and with .closest(), both with (‘label’), but both didn’t return an actual element but instead this object:

[prevObject: jQuery.fn.jQuery.init[1], context: <input>, selector: ".next(li)"]

Maybe someone can explain to me why I get this and not an element? and give me an idea how to get the required element?
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-14T15:40:50+00:00Added an answer on June 14, 2026 at 3:40 pm

    closest selects the first closest parent element(specified by the selector), you can select the parent li element and then find the label:

    $(this).closest('li').find('label')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this sounds like a really simple question but could easily have a very complicated
This sounds really simple and for the life of me I can not find
This sounds like a really simple question, but I am new to PHP. If
This sounds really simple but it's like an onion - lots of layers as
This probably sounds really stupid but I have noo idea how to implement jquery's
I know this sounds like a really, really simple use case and I'm hoping
this sounds really simple and stupid..but I'm having a hard time removing the content
i know this sounds really common and so trivial but , am having a
This question might be closed as it sounds vague but I'm really asking this
I have somewhat of a strange question that is not really technical, but 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.