숫자만 허용하기.

숫자 빼고는 지워집니다.




javascript number regexp /\d/g

javascript except number regexp /\D/g



var onlyNumber = function(obj){
	if(!checkNumber(obj.value)){
			alert('Only number area!');
			var regExt = /\D/g;	// except number regula express
			obj.value = obj.value.replace(regExt, '');
		}
}


var checkNumber = function(param){
	if ( !isNaN( param ) )		return true;
	else return false; 
}




ex) 12a ==> alert & 12


+ Recent posts