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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:40:43+00:00 2026-06-17T09:40:43+00:00

Okay, so I have a table with individual rows or parent rows with a

  • 0

Okay, so I have a table with individual rows or parent rows with a few children linked to that parent. I have icons to delete either that father, or the individual son. The icons will show a modal pop up (rather than an alert) to confirm delete. It works, but I’m going to have to repeat it a lot. I figure this can be simplified to find an ID or class since the modal show/hide works this way. Thanks in advance.

<script>
function delVesselAll(){
    $("#vessel_tab #father1").remove();
    $("#vessel_tab .son1").remove();
    document.getElementById(id).style.display = 'block';
};
function delVesselAll2(){
    $("#vessel_tab #father2").remove();
    $("#vessel_tab .son2").remove();
    document.getElementById(id).style.display = 'block';
};
</script>

And my html:

<td class="cell_50">
  <a style="text-decoration:none;" onclick="showModal('delAll1')"><img src="images/delete-row-icon1.png" title="Delete this row" height="12" width="12" class="father1Del" id="father1Del"/></a>
</td>
<div class="delModal" style="z-index:999999; margin-left:200px; margin-top:30px; display:none" id="delAll1">
  <img src="images/warning.png" />&nbsp;Are you sure you want to delete vessel and the corresponding tanks?<br />
  <input type="button" value="Cancel" class="hide" onclick="hideModal('delAll1')"/>
  <input type="button" value="Delete" onclick="delVesselAll()"/>
</div>

So I basically have many rows that do the same thing, that can have the class or ID “father1” “father2” “son1” “son2”. Also I would like these divs to fade in and fade out, using something like $(this).fadeIn('slow');
Thanks in advance.

  • 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-17T09:40:43+00:00Added an answer on June 17, 2026 at 9:40 am

    You can pass in the variable (potentially through a loop, though it depends on how your numbers are generated):

    function delVesselAll(num){
        $("#vessel_tab #father" + num).remove();
        $("#vessel_tab .son" + num).remove();
        document.getElementById(id).style.display = 'block';
    };
    

    Then call it like:

    delVesselAll(1);
    delVesselAll(2);
    

    If your numbers are predictable and sequential, you can iterate over them in a loop:

    for (var i = 1; i < $("[id^='father']").length; i++) {
        delVesselAll(i);
    }
    

    If that is not clear, you may want to check out this tutorial.

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

Sidebar

Related Questions

okay, i'm setting up a multi-user chat system. i have a messages table, that
Okay, I'm stumped here. I have a control that is comprised of a table.
Okay, I have a table that has a column called bdParameters , datatype is
QUESTION: Is it okay to have shortcut identifiers in a table so that I
Okay... So, I came across the following problem: I have one table that works
Okay so what I have is a table that keeps track of history on
Okay I have a table that looks as following: id | status(bool) | devicename(text)
I am wondering if it is okay to have master and detail table for
Okay, here's the situation: We have a table of about 50 columns (created by
Okay I have a large CRUD app that uses tabs with Forms embedded in

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.