dom parent and child relation

Aug 20 2016 5:54 AM
<div class="col-md-12">
<span class="unit-cost">Rs.<asp:Label ID="lblunitcost" CssClass="unitcost" runat="server"></asp:Label></span>
<span class="offer-price"><asp:Label ID="lblDelarcost" CssClass="delarcost" runat="server"></asp:Label></span>
</div>
<div class="col-md-12" align="right">
<asp:DropDownList ID="ddlmodel" runat="server" CssClass="qty-box" OnSelectedIndexChanged="ddlmodel_SelectedIndexChanged" AutoPostBack="false" onchange="onModelChange(this)">
</asp:DropDownList>
</span>
 
<script>
var showingcost=$(element).parent('span').parent('div').prev('div').childNodes[0];
showingcost.text(unit);
var showdelarcost=$(element).parent('span').parent('div').prev('div').secondChild('span');
showdelarcost.text(dealer);
 
</script> 
 its not working?

Answers (2)