Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the Previous Sibling name
    primarykey
    data
    text
    <p>I need to get the name of the previous sibling . to keep it simple i have some sample code </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function myFunction() { var itm=document.getElementById("item2"); alert(itm.previousSibling.name); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p name='pn'&gt;paragraph&lt;/p&gt; &lt;button id='item2' onclick="myFunction()"&gt;Try it&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Edit:</p> <pre><code>&lt;table id="sort"&gt; &lt;tr name="nodrag nodrop"&gt; &lt;td colspan=3&gt;&lt;strong&gt;&lt;a style="cursor:pointer;" class="toggle"&gt;Group 1&lt;/a&gt;&lt;/strong&gt; &lt;/td&gt; &lt;td style="text-align: right;"&gt;&lt;a class="button3" href="#" &gt;&lt;span&gt; Edit &lt;/span&gt;&lt;/a&gt; &lt;a class="button3" href="#" &gt;&lt;span&gt; Delete &lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="1" class="tr_group"'&gt; &lt;td style="width:10px;" class="dragHandle"&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;a href=# style="margin-left: 20px;"&gt;Umair Iqbal&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size: 12px; color: #999; line-height: 100%;"&gt;A Student at TUM&lt;/span&gt;&lt;/td&gt; &lt;td style="text-align: right;"&gt;&lt;a class="button3" href="#" &gt;&lt;span&gt; Edit &lt;/span&gt;&lt;/a&gt; &lt;a class="button3" href="#" &gt;&lt;span&gt; Delete &lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>The Ist row is the previous sibling of the second row. I want the name of the 1st row and all my ids will be dynamic</p> <p>thanks </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