붉은거위 노트 (redgoose note)

jQuery Note

Nest
Development
Category
Javascript
Hit
509
Star
0

내용추가

append('html'); // 내용추가(내용꼬리에 추가된다.)
prepend('html'); // 내용추가(내용머리에 추가된다.)

jQuery가 로드되었는지 확인하기

if (window.jQuery) {
  console.log(jQuery(document));
}

체크박스가 체크되어있는지 확인하기

체크박스를 클릭하고 체크가 되어있는지 확인하기. 토글 이벤트를 제작할 때 사용할 수 있다.

$('input').bind('click', function(){
  console.log($(this).is(':checked'));
});

iframe에서 location.href 사용하기

$('iframe').get(0).contentWindow.location.href = url;

부모요소중에 특정한 조건의 엘리먼트 찾기

$(this).closest('li');

1.9버전이후 없어진 $.browser값을 꼭 사용해야할때

http://n33.co/2013/03/23/browser-on-jquery-19x-for-legacy-ie-detection

jQuery.browser={};(function(){jQuery.browser.msie=false;
jQuery.browser.version=0;if(navigator.userAgent.match(/MSIE ([0-9]+)\./)){
jQuery.browser.msie=true;jQuery.browser.version=RegExp.$1;}})();