'focus'에 해당되는 글 1건

  1. 2010.09.26 유용한 놈들

유용한 놈들

JavaScript 2010. 9. 26. 15:06 |
String.prototype.number_format=function(){
  return this.replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1,');
}

String.prototype.trim = function() {
  return this.replace(/^\s+|\s+$/g, "");
}

String.prototype.strip_tags = function(){
  return this.replace(/<\/?[^>]+>/gi, '');
}

String.prototype.only_number = function(){
  return this.replace(/[^0-9\.]/gi, '');
}

String.prototype.only_number_dot = function(){
  return this.replace(/[^0-9\.]/gi, '');
}

String.prototype.only_eng_number = function(){
  return this.replace(/[^0-9A-Za-z]/gi, '');
}

// 텍스트박스에 기본값이 넣어져 있고, 포커스가 오면 기본 값을 없앤다. 의외로 유용함
var isInit = new Array();
$("input.required")
.each(function(idx){
isInit.push(false);
$(this).bind('focus', function(){
if( isInit[idx] == false ) {
isInit[idx]=true;
$(this).val('');
}
});
});

'JavaScript' 카테고리의 다른 글

Side Tab  (0) 2010.10.09
팝업 띄우기 주소보안 방법.  (0) 2010.10.07
jQuery Plug-in  (0) 2010.09.12
jQuery UI Tab Header 없애기  (1) 2010.08.31
jQuery 1.4변경사항  (0) 2010.08.30
Posted by 기계식키보드
: