Note that there are some explanatory texts on larger screens.

plurals
  1. POCopying values of one table to another (how to convert this js function to jQuery)
    text
    copied!<p>I am stuck with a small problem here.. What i am trying to do is copy description of id's from one table to another. I have writter half of the javascript and can anybody tell me how to convert this function in jquery. I want the description copied from the first table based on the id to the second table. Have done this in jquery using 'contains', (<a href="https://stackoverflow.com/questions/2449845/comparing-2-tables-column-values-and-copying-the-next-column-content-to-the-secon">Comparing 2 tables column values and copying the next column content to the second table</a>) since there are 1000 table rows, the explorer crashes. Is there a way to simplify it ??... the code is as follows...</p> <p>the current javascript works when i click on test in the second table, but i want the value to be appended in the second table on page load... pls help</p> <pre><code>&lt;table class="reportTabe"&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v1&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v1"&gt;some description1&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v1&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v1"&gt;some description1&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v3&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v3"&gt;some description3&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v4&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v4"&gt;some description4&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v5&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v5"&gt;some description5&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v6&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v6"&gt;some description6&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v7&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v7"&gt;some description7&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v8&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v8"&gt;some description8&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;psx-pdu120v9&lt;/td&gt;&lt;td class="itemname" id="psx-pdu120v9"&gt;some description9&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;table class="data"&gt; &lt;tr&gt;&lt;td class="whipItem"&gt;psx-pdu120v1&lt;/td&gt;&lt;td onClick="Javascript:alert(document.getElementById('psx-pdu120v1').innerText)";&gt;test&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td class="whipItem"&gt;psx-pdu120v3&lt;/td&gt;&lt;td onClick="Javascript:alert(document.getElementById('psx-pdu120v1').innerText)";&gt;test&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td class="whipItem"&gt;psx-pdu120v4&lt;/td&gt;&lt;td onClick="Javascript:alert(document.getElementById('psx-pdu120v5').innerText)";&gt;test&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td class="whipItem"&gt;psx-pdu120v5&lt;/td&gt;&lt;td Javascript:this.innerText=document.getElementById('psx-pdu120v4').innerText;&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td class="whipItem"&gt;psx-pdu120v6&lt;/td&gt;&lt;td Javascript:this.innerText=document.getElementById('psx-pdu120v5').innerText;&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td class="whipItem"&gt;psx-pdu120v7&lt;/td&gt;&lt;td Javascript:this.innerText=document.getElementById('psx-pdu120v6').innerText;&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td class="whipItem"&gt;psx-pdu120v8&lt;/td&gt;&lt;td Javascript:this.innerText=document.getElementById('psx-pdu120v7').innerText;&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td class="whipItem"&gt;psx-pdu120v9&lt;/td&gt;&lt;td Javascript:this.innerText=document.getElementById('psx-pdu120v8').innerText;&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre>
 

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