In my markup, my A element has a href equal to "": <a href="">
. When trying to display it though using an like for example alert(jQuery('#my_href_link').attr('href'))
, it returns "undefined" rather than an empty chain or something.
So the solutions I found everywhere:
if (jQuery('#my_href_link').attr('href') == '')
or
if (jQuery('#my_href_link').attr('href').length == 0)
... don't work.
Yet they seem to work for everybody except me. Why is that?
Markup:
<a id="my_href_link" href="">
<img src="image.jpg">
</a>