1.I want to check object exist or not, so I use the javascript the idea to check.
In the past I will write that:
If(document.getElementById('Id'))
{
//if exist ,I will do
}
else
{
//the object is not exist,I should to do
}
but I use the jquery do that,I found the jquery return the object every time, however the object is not exsit.
I found the resource in google.
some body support me use this method to do check the object exist.
用jquery判断一个对象是否存在不能用
if($ ("#id")){
}else{}
jquery不管对象存不存在都会返回object。
应该用
if($ ("#id").length>0){}else{}
or
if($ ("#id")[0]){ } else { }
or
if(document.getElementById("id")){} else {}