제이쿼리 활용 기법

label change

  • $('input[type=radio]') 형식은 $(':radio') 으로 축약할 수 있음

  • checked 확인 방법은 여러가지가 있음

1) if ($('input[type=checkbox]:checked').length > 0) {}

-제이쿼리 전용 메서드-
2) if ($('input[type=checkbox]').prop('checked') == true) {}

3) if ($('input[type=checkbox]').is(':checked') == true) {}

전체선택

  • attr() 은 DOM에서 불러오는 형식, 따로 함수를 이용해서 추가되는 것 인식X

  • prop() 은 배열로 불러오는 형식, 따로 함수를 이용해서 추가되는 것 인식O
    (boolearn 타입으로 불러옴 true/false)

  • .on(event,eliment,function) 메서드를 사용해서, .toggleClass 클래스 추가를 통한 if구문으로 완성

event handler

  • .mouseover() 메서드와 .mouseout 메서드 사용해서 이벤트 실행

  • .on() 메서드를 활용할 때는 객체 형태로 사용

  $(':submit').on({
    mouseover: function() {
      $(this).after('<p>입력한 내용을 서버로 전송합니다.</p>')
    },
    mouseout: function() {
      $(this).next().remove();
    }

profile
안녕하세요. 맡은 업무를 확실하게 수행하는 웹 개발자가 되기 위하여 끊임없이 학습에 정진하겠습니다.

0개의 댓글

Powered by GraphCDN, the GraphQL CDN