본문 바로가기
프론트기술/JavaScript

JQuery 객체에 메서드 추가하기

by RevFactory 2013. 4. 11.

JQuery 객체에 메서드를 추가하는 방법

 

1. 사용자 js에 추가

(function($, undefined) {
 $.fn.extend({
  func: (function( orig ) {
   alert(orig);
  })
 });
})(jQuery);

2. 사용하기

$('#portlet-area').func('hello');

'프론트기술 > JavaScript' 카테고리의 다른 글

Json - Object 간 변환  (0) 2013.05.28
JSON Object 와 String 간 변환  (0) 2013.01.05
JQuery -> Ajax 정리  (0) 2012.05.03