$(this).attr('id')
var rid = $(this).attr('id'); //for dynamically created elements
var myId = $("#test").prop("id");
$(document).ready(function() { console.log($('#test').attr('id')); });