[API] toggleClass()
2015. 7. 28. 13:55ㆍ[개발] 지식/Jquery
.toggleClass( className )
- classNameType: StringOne or more class names (separated by spaces) to be toggled for each element in the matched set.
version added: 1.3.toggleClass( className, state )
version added: 1.4.toggleClass( [state ] )
- stateType: BooleanA boolean value to determine whether the class should be added or removed.
version added: 1.4.toggleClass( function [, state ] )
- functionA function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the state as arguments.
- stateType: BooleanA boolean value to determine whether the class should be added or removed.
ex)
var main = function() { $(".btn").click(function() { $(".btn").toggleClass('btn-like'); }); }; $(document).ready(main);
'[개발] 지식 > Jquery' 카테고리의 다른 글
find()와 children()의 작동원리 (0) | 2016.11.04 |
---|---|
이벤트 중복 바인딩 방지 (0) | 2016.06.14 |
html()의 사용과 innerHTML (0) | 2016.06.14 |
[API] animate() (0) | 2015.07.27 |
<