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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:38:33+00:00 2026-06-02T23:38:33+00:00

I’m creating some html dynamically from an asp.net page and filling out a list

  • 0

I’m creating some html dynamically from an asp.net page and filling out a list of tables with links.
The behavior i’m looking for is hiding the images in the following rows when i click on the first element in the table, without hiding all the images in the rest of the table.
the jquery code i’m using is:

$(document).ready(function () {
    $('.AddMainInterest').click(function (event) {
        var url = $(this).attr("href");
        if ($.browser.msie) {//hacked together for IE browsers
            centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120) / 2) - (75)));
            centeredX = window.screenLeft + ((((document.body.offsetWidth + 20) / 2) - (150)));
        } else {
            centeredY = window.screenY + (((window.outerHeight / 2) - (75)));
            centeredX = window.screenX + (((window.outerWidth / 2) - (150)));
        }
        window.open(url, null, 'toolbar=no,location=no,menubar=no,width=300,height=150,resizable=yes,scrollbars=no,left=' + centeredX + ',top=' + centeredY).focus();
        event.preventDefault();
        this.href = this.href.replace("act=a", "act=d");
        $(this).prev().toggle();
        $("#imgInterest img").hide().filter(":first").show();
    });
});

but this is hiding all the following images, how can i make hide only the images in the same table???

the code looks something like the following:

   <table id="imgInterest" width="100%;">
    <tr>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=2&sc=Y&act=a" class="AddMainInterest">
                <img id="first" src="~/icons/CheckMark.png" class="first">Agriculture (General)</a>
        </td>
    </tr>
    <tr valign="middle">
        <td>
            <a href="~/page.aspx" class="AddInterest">Agricultural Facilities and Equipments</a><img
                src="~/icons/CheckMark.png" class="img-swap">
        </td>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=4&sc=Y01&act=a" class="AddInterest">Agricultural
                Science</a><img src="~/icons/CheckMark.png" class="img-swap">
        </td>
    </tr>
    <tr>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=5&sc=Y02&act=a" class="AddInterest">Algology</a><img
                src="~/icons/CheckMark.png" class="img-swap">
        </td>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=6&sc=Y03&act=a" class="AddInterest">Animal Behavior</a><img
                src="~/icons/CheckMark.png" class="img-swap">
        </td>
    </tr>
    <tr>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=7&sc=Y07&act=a" class="AddInterest">Animal Health
                and Nutrition</a><img src="~/icons/CheckMark.png" class="img-swap">
        </td>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=8&sc=Y04&act=a" class="AddInterest">Animal Physiology</a><img
                src="~/icons/CheckMark.png" class="img-swap">
        </td>
    </tr>
    <tr>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=9&sc=Y08&act=a" class="AddInterest">Aquaculture
                and Fisheries</a><img src="~/icons/CheckMark.png" class="img-swap">
        </td>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=10&sc=Y09&act=a" class="AddInterest">Crop and
                Plant Production</a><img src="~/icons/CheckMark.png" class="img-swap">
        </td>
    </tr>
    <tr>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=11&sc=Y05&act=a" class="AddInterest">Forestry
                Science</a><img src="~/icons/CheckMark.png" class="img-swap">
        </td>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=12&sc=Y10&act=a" class="AddInterest">Pesticides,
                Insecticides and Herbicides</a><img src="~/icons/CheckMark.png" class="img-swap">
        </td>
    </tr>
    <tr>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=13&sc=Y12&act=a" class="AddInterest">Plant Sciences</a><img
                src="~/icons/CheckMark.png" class="img-swap">
        </td>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=14&sc=Y11&act=a" class="AddInterest">Policy,
                Reviews and Evaluations</a><img src="~/icons/CheckMark.png" class="img-swap">
        </td>
    </tr>
    <tr>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=15&sc=Y13&act=a" class="AddInterest">Soil Sciences</a><img
                src="~/icons/CheckMark.png" class="img-swap">
        </td>
        <td>
            <a href="~/page.aspx?uid=-1&pid=10&sid=16&sc=Y14&act=a" class="AddInterest">Zoology
                and Animal Science</a><img src="~/icons/CheckMark.png" class="img-swap">
        </td>
        <td>
        </td>
    </tr>
</table>
</li><li>
    <table id="imgInterest" width="100%;">
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=17&sc=A&act=a" class="AddMainInterest">
                    <img id="first" src="~/icons/CheckMark.png" class="first">Arts and Literature (General)</a>
            </td>
        </tr>
        <tr valign="middle">
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=18&sc=A01&act=a" class="AddInterest">Architecture</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=19&sc=A02&act=a" class="AddInterest">Art History</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=20&sc=A03&act=a" class="AddInterest">Children's
                    Literature</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=21&sc=A04&act=a" class="AddInterest">Culture
                    Heritage</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=22&sc=A05&act=a" class="AddInterest">Folklore</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=23&sc=A06&act=a" class="AddInterest">Latin</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=24&sc=A07&act=a" class="AddInterest">Literature</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=25&sc=A08&act=a" class="AddInterest">Music</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=26&sc=A09&act=a" class="AddInterest">Visual and
                    Performing Arts</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <tr id="clear">
                <td>
                </td>
            </tr>
        </tr>
    </table>
</li>
<li>
    <table id="imgInterest" width="100%;">
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=27&sc=B&act=a" class="AddMainInterest">
                    <img id="first" src="~/icons/CheckMark.png" class="first">Astronomy/Astrophysics/Space
                    Science (General)</a>
            </td>
        </tr>
        <tr valign="middle">
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=543&sc=B10&act=a" class="AddInterest">Aircrafy
                    and Flight</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=544&sc=B11&act=a" class="AddInterest">Astronomy
                    and Astrophysics</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=28&sc=B01&act=a" class="AddInterest">Celestial
                    Mechanics</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=29&sc=B02&act=a" class="AddInterest">Cosmology</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=30&sc=B03&act=a" class="AddInterest">Extragalactic
                    Astronomy</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=31&sc=B04&act=a" class="AddInterest">Interstellar
                    Matter</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=32&sc=B05&act=a" class="AddInterest">Meteors</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=545&sc=B12&act=a" class="AddInterest">Policy,
                    Reviews and Evaluations</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=33&sc=B06&act=a" class="AddInterest">Solar Terrestrial
                    Physics</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=546&sc=B13&act=a" class="AddInterest">Space Exploration
                    and Development</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=547&sc=B14&act=a" class="AddInterest">Space Systems
                    and Hardware</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=34&sc=B07&act=a" class="AddInterest">Stars</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
        </tr>
        <tr>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=35&sc=B08&act=a" class="AddInterest">The Sun</a><img
                    src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
                <a href="~/page.aspx?uid=-1&pid=10&sid=36&sc=B09&act=a" class="AddInterest">Theoretical
                    Astrophysics</a><img src="~/icons/CheckMark.png" class="img-swap">
            </td>
            <td>
            </td>
        </tr>
    </table>
  • 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-02T23:38:35+00:00Added an answer on June 2, 2026 at 11:38 pm

    change

    $("#imgInterest img").hide().filter(":first").show();
    

    to

    $(this).closest("table").find("img").hide().first().show();
    

    By the way, don’t let different tables share same ID

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters 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.