Note that there are some explanatory texts on larger screens.

plurals
  1. POFirefox undefined value when using jquery to read cell elements
    primarykey
    data
    text
    <p>I have a table which is populated dynamically (using update panel), and then when a user clicks a chosen row, all the data is written to a label. Works fine in IE and chrome, but firefox says undefined. Simple table with 5 columns. I bind dynamically to the table with the following: (please excuse the code bloat)</p> <pre><code> $('#tblResults').delegate(".aRow", "click", function () { var thatID = this.id; if (thatID != "0") { var wordz = ""; var specialID = document.getElementById("hiddenChosenContact"); var targetContact = document.getElementById("theContactLabel"); for (var i = 1; i &lt;= this.cells.length - 1; i++) { if (i == this.cells.length - 1) wordz = wordz + this.cells[i].innerText; else wordz = wordz + this.cells[i].innerText + " - "; } targetContact.innerHTML = wordz; specialID.value = thatID; } else { } }); </code></pre> <p>The row is given an id and classname 'aRow' on load. I tried using full jquery only, $(this), but to be honest i am not sure on the syntax for table manipulation.</p> <p>**edit. Sorry, meant to say that the undefined value is contained within this.cells[i].innerText</p> <p>**HTML Edit</p> <pre><code>&lt;table class="cvTableG" id="tblResults" cellPadding="0" cellSpacing="0" style="clear:left; width:100%; font-size:10px;"&gt; &lt;thead&gt; &lt;tr class="aRow" id="1"&gt;&lt;th width="14px;"&gt;&amp;nbsp;&lt;/th&gt; &lt;th align="left" width="85px"&gt;Name&lt;/th&gt; &lt;th align="left" width="90px"&gt;Surname&lt;/th&gt; &lt;th align="left"&gt;Department&lt;/th&gt; &lt;th align="left"&gt;Customer&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr class="aRow" id="2"&gt; &lt;td style="padding:0;"&gt;&lt;input type="radio" name="myRadio" /&gt;&lt;/td&gt; &lt;td&gt;Marty&lt;/td&gt; &lt;td&gt;Elliott&lt;/td&gt; &lt;td&gt;Development Place&lt;/td&gt; &lt;td&gt;Rosebank&lt;/td&gt; &lt;/tr&gt; &lt;tr class="aRow" id="3"&gt; &lt;td style="padding:0;"&gt;&lt;input type="radio" name="myRadio" /&gt;&lt;/td&gt; &lt;td&gt;Sarah&lt;/td&gt; &lt;td&gt;Lee&lt;/td&gt; &lt;td&gt;Dev Place&lt;/td&gt; &lt;td&gt;JHB&lt;/td&gt; &lt;/tr&gt; &lt;tr class="aRow" id="4"&gt; &lt;td style="padding:0;"&gt;&lt;input type="radio" name="myRadio" /&gt;&lt;/td&gt; &lt;td&gt;Marty&lt;/td&gt; &lt;td&gt;Elliott&lt;/td&gt; &lt;td&gt;Halfway House&lt;/td&gt; &lt;td&gt;Durban&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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