<div class="pb" id="1"> <input type="button" class="editbar" onclick="doo(this)" id="fortest" value="Edit progressbar" /> </div> function doo(caller){ var parent = $(caller).parent().attr('id'); alert(parent); }