$('.comment[id]') would select the element itself instead of the attribute. [id] would only act as a filter.