jQuery

html()/addClass()/removeClass()

두루루루루 2017. 8. 22. 22:47

html()/addClass()/removeClass()



html( )

: Get the HTML contents of the first element in the set of matched elements or set the HTML contents of every matched element


* xml에서는 사용할 수 없다.


HTML 문서에서 어떤 요소의 내부 내용을 알아내고자 할때 html() 함수를 사용할 수 있습니다. 만일 선택자에 의해 선택된 요소가 복수개일 경우 제일 처음 요소의 값만 취합니다.


.html( htmlString )


innerHTML() = html()



addClass() / removeClass() 

: 특정한 클래스를 요소에 추가/삭제하는 메소드
-하나 이상의 클래스를 추가/삭제하려면 띄어쓰기해서 사용하면 됨