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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:23:22+00:00 2026-06-10T18:23:22+00:00

I use jquery and I want to find the previous div which has the

  • 0

I use jquery and I want to find the previous div which has the “error” class

My html code :

<table class="questions">
    <tr>
        <td class="heading">1
            <div class="error"></div>
        </td>

        <td colspan="4">
            <textarea class="textcontrol required" name='questionT136'>
            </textarea>
        </td>
    </tr>

    <tr>
        <td></td>

        <th><label for="reponse137-3">Très satisfaisant</label></th>
        <th><label for="reponse137-4">Satisfaisant</label></th>
        <th><label for="reponse137-5">Insatisfaisant</label></th>
    </tr>

    <tr class="q">
        <td class="heading">
            2
            <div class="error"></div>
        </td>

        <td class="questionradio"><input class="required" id='reponse137-3'
        name='questionN137' type='radio' value='3'></td>

        <td class="questionradio"><input class="required" id='reponse137-4'
        name='questionN137' type='radio' value='4'></td>
    </tr>
</table>

For example, from reponse137-3, I’d like to change the value the previous class=”error”. I allready tryied to access to that object with :

$('#reponse137-3').prev(".error")

but it doesn’t work. I think because it hasn’t the same parent, so I tryied :

$('#reponse137-3').prev("tr").next(".error")

How can I do ?

  • 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-10T18:23:24+00:00Added an answer on June 10, 2026 at 6:23 pm

    Assuming your .error div is always in the same table row:

    $('#reponse137-3').closest('tr').find('.error:first');
    

    http://jsfiddle.net/vkfF8/

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

Sidebar

Related Questions

In an HTML table I want to select some items, I use jQuery in
Suppose I have a string of HTML code. I want to use JQuery to
What I want to do is use jQuery to find a piece of text
Possible Duplicate: Find and Replace more than 1 word? I want to use jQuery
I want to use jQuery tabs ( http://jsfiddle.net/43FcS/2/ ) inside a div that's created
I'm trying to use jquery to find an item based on it's class name.
I use Jquery in my page to hide buttons which i dont want to
I want to use jquery to edit the class margin properties if its on
I want to use jQuery function to fetch web service response but getting error
I use jquery click event for a div and the div area has an

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.