Note that there are some explanatory texts on larger screens.

plurals
  1. POValid jQuery on Development fails on Production
    text
    copied!<p>I am writing a fairly basic script using jQuery. However, the script behaves differently depending on whether I am running it on my local Web server (localhost) or on a production server.</p> <p>On development, the following code returns the HTML I'm expecting: </p> <pre><code>$('#objID').siblings('.mAddress').html(); </code></pre> <p>On production, the same statement returns <code>undefined</code>.</p> <p>The document structures are the same on both machines. The only difference I can find is when I use Firebug to step through the script. On the development machine, putting a watch on $('#objID').siblings('.mAddress') results in <code>[ span#object ]</code> while on production the same watch results in <code>[ [ span#object ] ]</code><br> (Notice the double sets of square brackets).</p> <p>Any ideas?</p> <p>Added:</p> <p>I've verified that the two libraries are identical.</p> <p>I've done some more experimenting using Firebug. Another part of the script grabs a set of elements using the statement:</p> <pre><code>$('.ParentColumn2').each(function(i) { ... }) </code></pre> <p>Within the body of that function, if I set a watch on <code>this</code>, on development the value of <code>this</code> is what I expect: <code>div.ParentColumn2</code> , but on production the value of <code>this</code> returns what looks like an array: <code>[ div.ParentColumn2, div.ParentColumn2, div.ParentColumn2, .....]</code></p> <p>The HTML is basically a table (I've stripped out irrelevant HTML, and the rows repeat):</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;div class="ItemTemplate"&gt; &lt;div class="ParentColumn2"&gt; &lt;div&gt;&lt;span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lbl_Address" class="lbl_Address mAddress"&gt;111 W Wacker Dr, &lt;/span&gt;&lt;span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lbl_City" class="lbl_Address mCity"&gt;Chicago&lt;/span&gt;&amp;nbsp;&lt;span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lbl_PostalCode" class="lbl_Address mPostalCode"&gt;60601&lt;/span&gt;&amp;nbsp;&lt;a href="javascript:MapMe(this);" id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_hypMap" class="hypMap"&gt;Map&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lbl_Area" class="mArea"&gt;Loop&lt;/span&gt;&lt;span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lt" class="mLt"&gt;41.8868010285473&lt;/span&gt;&lt;span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lg" class="mLg"&gt;-87.6312860701286&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div class="ItemTemplate"&gt; &lt;div class="ParentColumn2"&gt; &lt;div&gt;&lt;span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl03_lbl_Address" class="lbl_Address mAddress"&gt;...&lt;/span&gt; ... &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>The HTML is as identical between the two machines as can be possible given that it's all generated by .Net (don't get me started).</p>
 

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