//注意:不能直接用if($('#mydiv')),因为jquery所有函数和对象都是默认返回true,因为 Jquery 会自动忽略空元素,以免返回错误值。
if
($(
'#mydiv'
).html()!==
''
){
alert(
'存在mydiv元素'
);
};