$('#test')
returns a jQuery object, so you can't use simply object.id
to get its Id
you need to use $('#test').attr('id')
, which returns your required ID
of the element
This can also be done as follows ,
$('#test').get(0).id
which is equal to document.getElementById('test').id