判断子元素(or属性)是否存在

if(typeof($("#aid").attr("rel"))=="undefined") 即可

原文地址:https://www.cnblogs.com/afei-happy/p/4042774.html