<div class="codetitle"> <span><a style="CURSOR: pointer" data="6647" class="copybut" id="copybut6647" onclick="doCopy('code6647')"><u>코드 복사</u></a></span> 코드는 다음과 같습니다.</div> <div class="codebody" id="code6647"> <br><%@ page Language="java" contentType= "text/ html; charset=UTF-8" <BR>pageEncoding="UTF-8"%> <br><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http :// www.w3.org/TR/html4/loose.dtd"> <br><html> <br><head> <br><meta http-equiv="Content-Type" content= "text/ html; charset=UTF-8"> <br><title>jqueryMenu</title> <br><script type="text/javascript" src="js/jquery-1.10.2.js "> </script> <br><script type="text/javascript"> <br>$(document).ready(function(){ <br>var allMenu=$("ul > a "); //모든 메인 메뉴 찾기<br>allMenu.click(function(){ <br>var list=$(this).nextAll('li'); //현재 클릭된 항목의 모든 li 형제 노드 찾기 node<br>list.toggle('show'); <br>}) <br></head> ><ul> <a href="#">메뉴 1</a> <br><li><a href="#"><br><li><a href="#">하위 메뉴 2</a></li> <br></ul> <br><ul><a href=" #" >메뉴 2</a> <br><li><a href="#">하위 메뉴 1</a></li> <br><li>< ">하위 메뉴 2</a></li> <br></ul> <br></body> <br></html> <br><br></a></li> </ul> </div>