js判断当前内容是否为空

function  isValue(o) {
    return (this.isObject(o) || this.isString(o) || this.isNumber(o) || this.isBoolean(o));
}
function isString(o) {
    return typeof o === 'string';
}
function isObject(o){
    return (o && (typeof o === 'object' || $.isFunction(o))) || false;
}

//判断当前字符串是否为空
function isEmpty(o) {
    if (!this.isString(o) && this.isValue(o)) {
        return false;
    } else if (!this.isValue(o)) {
        return true;
    }
    o = $.trim(o).replace(/\&nbsp\;/ig, '').replace(/\&#160\;/ig, '');
    return o === "";
}

 

posted @ 2016-05-13 10:50  wavemelody  阅读(348)  评论(0编辑  收藏  举报