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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:50:04+00:00 2026-06-10T17:50:04+00:00

my code <table id=mytable> <tr> <td>Text 5</td> <td>Other text 5</td> <td><input name=name5 value=></td> <td><input

  • 0

my code

<table id="mytable">
<tr>
    <td>Text 5</td>
    <td>Other text 5</td>
    <td><input name="name5" value=""></td>
    <td><input type="checkbox" value="5" name="records"></td>
</tr>
<tr>
    <td>Text 7</td>
    <td>Other text 7</td>
    <td><input name="name7" value=""></td>
    <td><input type="checkbox" value="7" name="records"></td>
</tr>
<tr>
    <td>Text 13</td>
    <td>Other text 13</td>
    <td><input name="name13" value=""></td>
    <td><input type="checkbox" value="13" name="records"></td>
</tr>
</table>

get the middle input checkbox with

$('#mytable input[type=checkbox][name=records][value=7]')

good 🙂

now, how can i get the prev input () and the next () input?

i try

$('#mytable input[type=checkbox][name=records][value=2]').prev('input[type=checkbox]')

for prev, but not works 🙁

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-10T17:50:05+00:00Added an answer on June 10, 2026 at 5:50 pm

    Assuming you have a reference to that middle checkbox in checkbox, and also assuming that there is only going to be one checkbox descendant of each tr element:

    //Previous checkbox:
    checkbox.closest("tr").prev().find(":checkbox");
    
    //Next checkbox:
    checkbox.closest("tr").next().find(":checkbox");
    

    This gets the ancestor tr element with .closest(), and then uses .prev() or .next() to select the previous or following tr, and then finds any checkbox descendants of that.

    Also note the use of the :checkbox selector, which is basically a shortcut to the attribute selector you are currently using. You can use either, but the attribute selector is probably a bit faster since it’s a native CSS selector.

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

Sidebar

Related Questions

I have a table like below <table id=mytable> <tr><th>checked</th><th>id</th><th>text</th></tr> <tr><td><input id=cb1 type=checkbox name=checker1/></td><td>123</td><td>abc</td></tr> <tr><td><input
Consider the following code: @Entity @Table(name = a) public class A implements Serializable {
I have a code: CREATE TABLE IF NOT EXISTS Person ( name varchar(24) ...
Here is the LaTeX code for my table: \begin{table}{| c || c | c
Here is jquery code which hides my table cells with the ID of .style2:
Using the code below I can insert a new row to my table (
i wanna do a single selection in my table view here is my code
I quite often have rows of code like the following: UPDATE my_table SET name
In JavaScript code of web application, the table sorter is defined by: $(#my-table).tablesorter({ headers:
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`

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.