I'm trying to get the IDs from my parent divs
<div id="btn1"><label class="btn"><input type="submit" value="Submit"/></label></div>
<div id="btn2"><label class="btn"><input type="button" value="Add"/></label></div>
jQuery function:
$('.btn').each(function () {
alert($('.btn').parent().attr("id"));
});
The function returns the value 'btn1' two times. It should return 'btn1', 'btn2'.
Thanks in advance.