Javascript

imported>Bbon님의 2014년 1월 16일 (목) 09:40 판

자주 사용하는 함수 구현

trim() 구현

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

replaceAll() 구현

String.prototype.replaceAll = function(target, replacement) {
  return this.split(target).join(replacement);
};

Window.opne()

팝업을 열고, 팝업창이 닫힐때 부모창 리로드

$(window).on('beforeunload', function () {
                opener.location.replace(opener.location.href);
            });