I have a few divs that are created using PHP. The anchor within the div always has a HREF, even if it is blank. Basically, I am trying to detect if the HREF is blank. If it
You can simply test the attribute as a boolean instead of testing it against undefined:
undefined
if ($(this).attr('href')) { // href is not blank } else { // href is blank }