<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>toggle button</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#btn1").toggle(
function()
{
$("#content").css("display",'none');
},
function()
{
$("#content").css("display","block");
});
});
</script>
</head>
<body>
<button id="btn1">toggle button</button>
<div id="content">
토글버튼을 만들어 보자.
</div>
</body>
</html>
// 토글버튼을 이용한 접기, 열기 기능.
// css 속성 말고.. $("#content").hide(); show(); 로도가능
'JQUERY' 카테고리의 다른 글
탭포커싱이 용이한 마우스오버 메뉴 제이쿼리 (동시에 두 가지 이벤트 사용) (0) | 2014.04.28 |
---|---|
목록순서 변경하기(드래그앤드롭) (1) | 2014.04.23 |
jquery e.target와 e.currentTarget의 차이 (0) | 2014.04.12 |
jQuery hide(), show(), toggle() (0) | 2014.04.12 |
[javascript] split 사용하기 (0) | 2014.04.04 |
jquery selectbox(중요) (0) | 2014.04.04 |
.is() 와 .next() 에 대해 (0) | 2014.04.04 |
JQUERY 참조 블로그 (0) | 2014.04.04 |