링크: http://www.sean-o.com/jquery/jmp3/

'JavaScript > jQuery' 카테고리의 다른 글

[jQuery] jQuery form validation  (0) 2014.06.05
[jQuery] jquery-validation document  (0) 2014.05.07
[jQuery] jQuery-File-Upload  (0) 2014.05.06
[jQuery] jQuery Form validator  (0) 2013.11.18
[jQuery] jQuery.serializeObject 만들기  (0) 2013.10.15
posted by 뚱2

링크: http://blog.naver.com/goolungsoi?Redirect=Log&logNo=10112463395

'JavaScript > jQuery' 카테고리의 다른 글

[jQuery] jQuery plugin jmp3  (0) 2014.06.25
[jQuery] jquery-validation document  (0) 2014.05.07
[jQuery] jQuery-File-Upload  (0) 2014.05.06
[jQuery] jQuery Form validator  (0) 2013.11.18
[jQuery] jQuery.serializeObject 만들기  (0) 2013.10.15
posted by 뚱2

링크: http://jqueryvalidation.org/documentation/

링크: http://jqueryvalidation.org/validate

'JavaScript > jQuery' 카테고리의 다른 글

[jQuery] jQuery plugin jmp3  (0) 2014.06.25
[jQuery] jQuery form validation  (0) 2014.06.05
[jQuery] jQuery-File-Upload  (0) 2014.05.06
[jQuery] jQuery Form validator  (0) 2013.11.18
[jQuery] jQuery.serializeObject 만들기  (0) 2013.10.15
posted by 뚱2

링크: https://github.com/blueimp/jQuery-File-Upload

문서: https://github.com/blueimp/jQuery-File-Upload/wiki

'JavaScript > jQuery' 카테고리의 다른 글

[jQuery] jQuery form validation  (0) 2014.06.05
[jQuery] jquery-validation document  (0) 2014.05.07
[jQuery] jQuery Form validator  (0) 2013.11.18
[jQuery] jQuery.serializeObject 만들기  (0) 2013.10.15
[jQuery] DataTables (table plug-in)  (0) 2013.01.02
posted by 뚱2
링크 : http://formvalidator.net/index.html



posted by 뚱2

    $.fn.serializeObject = function() {
        var o = {};
        var a = this.serializeArray();

        $.each(a, function() {
            if ( o[this.name] ) {
                if ( !o[this.name].push ) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
    };

posted by 뚱2

링크 : http://www.datatables.net/ 

링크 : http://www.datatables.net/release-datatables/examples/basic_init/zero_config.html 

posted by 뚱2

링크 : http://asyncweb.blogspot.kr/2012/04/jquery-attr-selected-property-ie6-bug.html

링크 : http://csharperimage.jeremylikness.com/2009/05/jquery-ie6-and-could-not-set-selected.html 


posted by 뚱2

jQuery 홈페이지에서 현재 2012-12-06일 기준으로 1.6 버전까지 다운로드 할 수 있습니다.


이전버전이 필요한 분들에게 요긴할 것 같습니다.


링크 : http://www.oldapps.com/jquery.php 


posted by 뚱2

링크 : http://sizzlejs.com/ 


시간 나는대로 분석해 봐야겠다.

posted by 뚱2

결국 arguments의 length 속성을 이용한다.

val: function( value ) {

var hooks, ret, isFunction,

elem = this[0];


if ( !arguments.length ) {

if ( elem ) {

hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];


if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {

return ret;

}


ret = elem.value;


return typeof ret === "string" ?

// handle most common string cases

ret.replace(rreturn, "") :

// handle cases where value is null/undef or number

ret == null ? "" : ret;

}


return;

}


isFunction = jQuery.isFunction( value );


return this.each(function( i ) {

var self = jQuery(this), val;


if ( this.nodeType !== 1 ) {

return;

}


if ( isFunction ) {

val = value.call( this, i, self.val() );

} else {

val = value;

}


// Treat null/undefined as ""; convert numbers to string

if ( val == null ) {

val = "";

} else if ( typeof val === "number" ) {

val += "";

} else if ( jQuery.isArray( val ) ) {

val = jQuery.map(val, function ( value ) {

return value == null ? "" : value + "";

});

}


hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];


// If set returns undefined, fall back to normal setting

if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {

this.value = val;

}

});

}


posted by 뚱2

[jQuery] PlugIn 만들기

JavaScript/jQuery 2012. 8. 8. 23:20

링크 : http://docs.jquery.com/Plugins/Authoring 

posted by 뚱2

<script type="text/javascript">

// 기존코드

if ( slt_SF_CLS.disabled == true ) {

}


// 위와 같은 코드를 아무생각 없이 jQuery를 이용해서 아래와 같이 변경했더니 안됐다.

// 이걸 어떻게 찾아 ㅡㅡ;

if ( $(slt_SF_CLS).attr("disabled") == true ) {

}


// 암튼 출력 해보면

$(slt_SF_CLS).attr("disabled", false);

alert($(slt_SF_CLS).attr("disabled"));    // undefined

$(slt_SF_CLS).attr("disabled", true);

alert($(slt_SF_CLS).attr("disabled"));    // disabled


// readonly attribute도 마찬가지 이다.

$(slt_SF_CLS).attr("readonly", false);

alert($(slt_SF_CLS).attr("readonly"));    // udefined

$(slt_SF_CLS).attr("readonly", true);

alert($(slt_SF_CLS).attr("readonly"));    // readonly

</script>


// HTML

<select id="slt_SF_CLS" name="slt_SF_CLS">

</select>


'JavaScript > jQuery' 카테고리의 다른 글

[jQuery] val 메소드 getter, setter 구별법  (0) 2012.08.30
[jQuery] PlugIn 만들기  (0) 2012.08.08
[jQuery] .each $.each 순회중 continue, break 하기  (0) 2012.07.26
[jQuery] ajaxForm 구현  (0) 2012.07.23
[jQuery] Plugin Validation  (0) 2012.06.18
posted by 뚱2

// 예)

var ADC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

$.each(ADC, function(i, rs) {

if ( rs == 5 ) {

return true; // for 문의 continue;와 같다.

}

else if ( rs == 8 ) {

return false; // for 문의 break;와 같다.

}


// ... 작업들

});


'JavaScript > jQuery' 카테고리의 다른 글

[jQuery] PlugIn 만들기  (0) 2012.08.08
[jQuery] .attr("disabled") .attr("readonly") 리턴값  (0) 2012.08.01
[jQuery] ajaxForm 구현  (0) 2012.07.23
[jQuery] Plugin Validation  (0) 2012.06.18
[jQuery] jQuery.type() 함수 구현해보기  (0) 2012.02.08
posted by 뚱2

[jQuery] ajaxForm 구현

JavaScript/jQuery 2012. 7. 23. 00:31

사실 ajax를 이용하는게 아니라 예전부터 많이 사용하던 iframe을 이용하여 화면 깜빡임을 없애는 방식이다.


/**

 * form을 ajax로 전송한다. (파일 포함)

 */

$.fn.ajaxForm = function(handler) {

    var $this = $(this);

    if ( $this[0] && $this[0].tagName.toUpperCase() == "FORM" ) {

        //랜덤한 수를 출력

        var ranNumber = Math.floor(Math.random() * 10000) + 1;

        var strId = "";

        strId += "SEED";

        strId += "_";    

        strId += (new Date()).getTime();

        strId += "_" + ranNumber;


        $this.attr("target", strId);    

        $("<iframe id=\"" + strId + "\" name=\"" + strId + "\" />")

            .hide()

            .appendTo($this.parents("body"))

            .load(function() {

                var that = this;


                if ( $.type(handler) == "function" ) {

                    var result = $.parseJSON(window.frames[strId].document.body.innerHTML);

                    if ( result == undefined || result == null || result == "" ) {

                        result = {

                            success : false,

                            message : "결과가 존재하지 않습니다."

                        };

                    }

                    handler(result);

                }

            });

    }//if ( $this[0] && $this[0].tagName.toUpperCase() == "FORM" ) {


    return $this;

};


사용방법

(function($, exports) {$(document).ready(function() {

////////////////////////////////////////////////////////////////////////////////////

$("#myform").ajaxForm(function(result) {

    if ( result && result.success == true ) {

        alert(result.message);

    }

});

////////////////////////////////////////////////////////////////////////////////////

});})(jQuery, window);



참고 : http://hanjiq.egloos.com/2373084 

posted by 뚱2

[jQuery] Plugin Validation

JavaScript/jQuery 2012. 6. 18. 09:59

다운로드 : http://bassistance.de/jquery-plugins/jquery-plugin-validation/


링크 : http://mytory.co.kr/archives/195 

posted by 뚱2
욜심히 만들었더니 jQuery.type() 이란 메소드가 있다. ㅡㅡ; 찾아볼걸...
// getType(true) "boolean"를 리턴
// getType(1) "number"를 리턴
// getType(1.1) "number"를 리턴
// getType("") "string"를 리턴
// getType(function(){}) "function"를 리턴
// getType(new Date()) "date"를 리턴
// getType(/^$/) "regexp"를 리턴

function getType(obj) {
    var  msg   = "undefined" 
        ,myObj = obj
        ;
    if ( myObj != null ) {
        var strType = Object.prototype.toString.call(myObj);
        var match   = strType.match(/^\[object (.+)\]$/i);
    
        msg = match && match[1].toLowerCase();            	
    }
    
    return msg;
}


posted by 뚱2
링크 : http://jqapi.com/
링크 : http://visualjquery.com (트레픽 제한이 있는지 가끔 무지하게 느리다.)

posted by 뚱2
posted by 뚱2

var gridData = $(ID.GRID_MAIN).getArrayFromMultiSelectedRow();

if ( gridData.length == 0 ) {

    // 항목을 선택하세요.

    alert("<g:message code='MESSAGE.com.msg.select' />");

    return;

}

 

$.ajax({

    url         : './_deleteDiagnosisTargetList.do'

   ,type        : 'POST'

   ,cache       : false

   ,data        : JSON.stringify({data:gridData})

   ,contentType : 'application/json; charset=utf-8'

   ,dataType    : 'json'

   ,success     : function(result) {

       if ( result.success == true ) {

           var str = "";

           $.each(result.list, function(index, rec) {

                str += rec + "\n";

           });

           alert(str);

           $(ID.GRID_MAIN).trigger("reloadGrid");

       }

   }

   ,error: function(result) {

   }

});


posted by 뚱2
jQuery의 serializeArray를 이용한다.



위의 폼을 var arr = $("#listForm").serializeArray()를 호출하면
// 아래와 같은 arr의 형태로 생성된다.
arr = [
    {name : 'test_01', value : '1'}
   ,{name : 'test_02', value : '2'}
   ,{name : 'test_03', value : '3'}
];

그래서 위의 serializeArray 메소드를 이용해서 json형태로 만들어준다.
/**
 * jqGrid
 * desc   : form의 데이터를 json 형태로 변환해 준다.
 * return : 성공시에는 객체(JSON)을 리턴한다. 실패시에는 null을 리턴한다.
 */
jQuery.fn.serializeObject = function() {
	var obj = null;
	try {
		if ( this[0].tagName && this[0].tagName.toUpperCase() == "FORM" ) {
			var arr = this.serializeArray();
			if ( arr ) {
				obj = {};
				jQuery.each(arr, function() {
					obj[this.name] = this.value;
				});				
			}//if ( arr ) {
 		}
	}
	catch(e) {alert(e.message);}
	finally  {}
	
	return obj;
};



posted by 뚱2
구글에서 jQuery를 항상 최신으로 유지시켜주는 URL이다.
개발할때 유용할 듯 하다.

* 1.X.X 버전 지원 (jQuery 버전이 업데이트 되면 같이 업데이트 된다.)
경량화 버전 :  https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
일반 버전 : https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js







posted by 뚱2
jQuery에서 검색 메소드 입니다.
다양한 검색 메소드들이 있지만 이 세가지 (find, filter, children) 메소드를 헷갈릴때가 있습니다.

filter : 현재 검색된 객체(집합)에서 다시 한번 검색하는 메소드
find : 현재 검색된 객체(집합)의 자손들에서 검색 하는 메소드, 자식의 레벨은 상관없습니다.
children : 현재 검색된 객체(집합)의 직속 자식만 검색하는 메소드

filter는 검색된 결과 객체 집합에서 특정 집합으로 다시 한번 검색 할때 사용합니다.
find 검색된 결과 객체 집합의 하위레벨을 다 뒤져서(자손) 검색 할때 사용 합니다.
children 검색된 결과 객체 집하의 바로 자식들만 뒤져서(자식) 검색 할때 사용합니다.

* 참고
  filter : http://api.jquery.com/filter/
  find  : http://api.jquery.com/find/
  children : http://api.jquery.com/children/
posted by 뚱2



// 추가
$("< OPTION >< /OPTION >")
	.attr("selected", "selected")
	.text("추가")
	.attr("value", "추가")
	.appendTo("select[name='test']");

// 선택
var value = $("select[name='test'] option:selected").val();
var name = $("select[name='test'] option:selected").text();

// 특정 삭제
$("select[name='test'] option[value='추가']").remove();
// 선택 삭제
$("select[name='test'] option:selected").remove();
// 모두 삭제
$("select[name='test'] option").remove();




posted by 뚱2

[jQuery] serialize()

JavaScript/jQuery 2011. 10. 17. 18:13
참고 : http://api.jquery.com/serialize/

폼객체의 엘리먼트들을 데이터 인코딩까지 해서 연결해주는 기능이다.
편한기능
posted by 뚱2