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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:08:48+00:00 2026-06-12T22:08:48+00:00

Trying to grab the table ID from table id=1 in below html / script

  • 0

Trying to grab the table ID from table id=”1″
in below html / script
when click on Account or Bill link I would like to grab the table ID so I could pass that table ID to another function to grab AJAX data. table ID is crated dyno. this is test data

<html>
<head>
<script src="jquery-1.8.2.min.js"></script>
<script type = "text/javascript">
$(document).ready(function() {                  
                $('.toggler').click(function(event){
                    event.preventDefault();
                    $(this).parent().find('.content').slideToggle();
                    var a = $(this).next("div").find(".content").children().attr("id");
                    alert(a);

                }); 
</script>
</head>
<body>
<table border="1">
    <tr>
        <td>
            <table id="MainTable">
                <tr>
                    <td>
                        <div class="toggler-wrap">
                            <a href="#" class="toggler">Account </a>
                            <a href="#" class="toggler">Bill</a>
                            <div class="content">   
                                <table id="1">
                                    <tr><td>Content will come here</td></tr>                                    
                                </table>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <table id="MainTable">
                <tr>
                    <td>
                        <div class="toggler-wrap">
                            <a href="#" class="toggler">Account</a>
                            <a href="#" class="toggler">Bill</a>
                            <div class="content">   
                                <table id="2">
                                    <tr><td>Content will come here</td></tr>                                    
                                </table>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    </table>
</body>
</html>
  • 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-12T22:08:50+00:00Added an answer on June 12, 2026 at 10:08 pm
    $('.toggler').click(function(event){
       event.preventDefault();
       $(this).parent().find('.content').slideToggle();
       var a = $(this).parent().find('table').attr("id");
       alert(a);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to grab data from an Html table on a website. No XML
I'm trying to build a query to grab all rows from Table 1, then
I would like to access profiles table from my Profile model which belongs_to :user
I'm trying to randomly grab about 20 random rows from a table, then using
I'm trying to grab the latest ID from a duplicate record within my table,
I am trying to grab the string off an object in a table row
Im trying to grab the destination (dynamic) of a link (static) with php Im
I have been trying to grab a file from an alternate git branch and
I was trying to grab some data from the database using JQuery AJAx, and
I have a site http://www.coldwellbankerpbr.com/listings.aspx that I am trying to grab the listings from,

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.