I am calling a javascript function from my onclick passing this keyword as parameters.I need to print id of used in the div.But it shows undefined.
<div class="btn-group" tabindex="0"><a class="btn active btn-danger" onclick="functionTest(this)" id="male" >Male</a><a class="btn btn-default" onclick="functionTest(this)" id="female">Female</a></div>
below is my function
function functionTest(obj){
alert("ok");
alert($(this).attr('id'));
}
I am not getting my id,IT SHOWS UNDEFINED
.
Can anybody help me any help will be highly appreciable..