How would I select elements that have any ID? For example:
if ($(\".parent a\").hasId()) { /* then do something here */ }
I, by no mean
You can use jQuery's .is() function.
if ( $(".parent a").is("#idSelector") ) { //Do stuff }
if ( $(".parent a").is("#idSelector") ) {
//Do stuff
}
It will return true if the parent anchor has #idSelector id.