Is
$(this).attr('id')
the same as:
this.id
No, they're not exactly the same.
They'll both return the element's ID, but if the element has no ID, then this.id will return a blank string while $(this).attr("id") will return undefined.
$(this).attr("id")
undefined
2.1m questions
2.1m answers
60 comments
57.0k users