You can use either:
this.id // <== more efficient and faster
or
$(this).attr("id")
this is a DOM element, as you can see on this MDC reference page you can use the id property of a DOM element to set or get that element's id.
You can create a jQuery object out of this by wrapping it like so: $(this). $(this) is not a DOM element, so it doesn't have the id property. Instead, you can use the .attr() jQuery method to get the id of the DOM element that is being represented by the jQuery object $(this).
Whenever you can use native DOM properties directly, it is faster than using jQuery methods, so this.id is more efficient than $(this).attr("id").
jsFiddle example