Hi all i have a which looks like this
<div id="Address1" class="span4">
<ul class="address-customstyle unstyled">
<a href="#"><i onclick="EditAddress(this.id)" id="2" class="icon-edit mrglft largesize">
</i></a><a href="#"><i onclick="DeleteAddress(this.id)" id="Address1" class="icon-remove mrglft largesize">
</i>
</a>
<li>
<label>
<strong>
<u id="addressname">
asdasd
</u>
</strong>: </label>
<span>
<p id="hno">asdasd</p>,
<p id="streetname">asdasd</p>,
<p id="city">asdasd</p>,<p value="1" id="state">Andhra Pradesh</p>
</span></li></ul></div>
now when i click on EditIcon i have the id of this
<i onclick="EditAddress(this.id)" id="2" class="icon-edit mrglft largesize">
now what i want is based on this i have to get the parent div and the values of its childrens
like values of all “p” elements and value of “u” can any one tell me how can i do this
this waht i am doing for now but its not going in the loop
function EditAddress(addressid) {
alert(addressid);
alert(addresses);
$("" + "#" + addressid + "").parent('.span4').find('p').each(function () {
var $span = $(this);
var spanId = $span.attr('id');
alert(spanId);
var spanTxt = $span.text()
alert(spanTxt);
});
You must do like this, It will reduce the looping level.