Note that there are some explanatory texts on larger screens.

plurals
  1. POSimplify and rewrite my repetitive code
    primarykey
    data
    text
    <p>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.</p> <pre><code>&lt;script&gt; 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'; }; &lt;/script&gt; </code></pre> <p>And my html:</p> <pre><code>&lt;td class="cell_50"&gt; &lt;a style="text-decoration:none;" onclick="showModal('delAll1')"&gt;&lt;img src="images/delete-row-icon1.png" title="Delete this row" height="12" width="12" class="father1Del" id="father1Del"/&gt;&lt;/a&gt; &lt;/td&gt; &lt;div class="delModal" style="z-index:999999; margin-left:200px; margin-top:30px; display:none" id="delAll1"&gt; &lt;img src="images/warning.png" /&gt;&amp;nbsp;Are you sure you want to delete vessel and the corresponding tanks?&lt;br /&gt; &lt;input type="button" value="Cancel" class="hide" onclick="hideModal('delAll1')"/&gt; &lt;input type="button" value="Delete" onclick="delVesselAll()"/&gt; &lt;/div&gt; </code></pre> <p>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 <code>$(this).fadeIn('slow');</code> Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload