Jquery create new system api Refer to http://stackoverflow.com/questions/31044/is-there-an-exists-function-for-jquery jQuery.fn.exists =function(){returnthis.length>0;}if($(selector).exists()){ // Do something}