`
退役的龙弟弟
  • 浏览: 446346 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

js判断字符串是否为空(判断字符串长度)

 
阅读更多

 

//去空格
function trim(str){     
		            return str.replace(/^(\s|\u00A0)+/,'').replace(/(\s|\u00A0)+$/,'');     
		     } 

//假如列表为空,只能选择黑名单,不为空可以选择白名单
function changeChecked(){
					var str = trim($("#content").html());
					if(str.length == 0){
						$(".nameList[value='0']").attr("checked","true");
						$(".nameList[value='1']").attr("disabled","disabled");
					}else{
						$(".nameList").removeAttr("disabled");
					}
				}

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics