handle the case when the element has no href attribute
handle the case when the element has no href attribute