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.
On development, the following code returns the HTML I'm expecting:
$('#objID').siblings('.mAddress').html();
On production, the same statement returns undefined
.
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 [ span#object ]
while on production the same watch results in [ [ span#object ] ]
(Notice the double sets of square brackets).
Any ideas?
Added:
I've verified that the two libraries are identical.
I've done some more experimenting using Firebug. Another part of the script grabs a set of elements using the statement:
$('.ParentColumn2').each(function(i) { ... })
Within the body of that function, if I set a watch on this
, on development the value of this
is what I expect: div.ParentColumn2
, but on production the value of this
returns what looks like an array: [ div.ParentColumn2, div.ParentColumn2, div.ParentColumn2, .....]
The HTML is basically a table (I've stripped out irrelevant HTML, and the rows repeat):
<table>
<tr>
<td>
<div class="ItemTemplate">
<div class="ParentColumn2">
<div><span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lbl_Address" class="lbl_Address mAddress">111 W Wacker Dr, </span><span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lbl_City" class="lbl_Address mCity">Chicago</span> <span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lbl_PostalCode" class="lbl_Address mPostalCode">60601</span> <a href="javascript:MapMe(this);" id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_hypMap" class="hypMap">Map</a> <span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lbl_Area" class="mArea">Loop</span><span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lt" class="mLt">41.8868010285473</span><span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl02_lg" class="mLg">-87.6312860701286</span>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="ItemTemplate">
<div class="ParentColumn2">
<div><span id="dnn_ctr45874_ViewProjectGrid_GridView1_ctl03_lbl_Address" class="lbl_Address mAddress">...</span> ...
</div>
</div>
</div>
</td>
</tr>
</table>
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).