HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <div class="guideBox"> <p>검색조건<span class="textbtn">[열기]</span></p> <div style="display:none"> <div> <dl> <dd> <select id="a" name="a"> <option value="a1">A1</option> <option value="a2">A2</option> <option value="a3">A3</option> </select> </dd> </dl> </div> </div> </div> | cs |
Script
1 2 3 4 5 6 7 8 9 | $(document).on("click",".guideBox > p",function(){ if($(this).next().css("display")=="none"){ $(this).next().show(); $(this).children("span").text("[닫기]"); }else{ $(this).next().hide(); $(this).children("span").text("[열기]"); } }); | cs |
'3.자바스크립트 > JavaScript' 카테고리의 다른 글
테이블 tr, td 등 선택하기 (0) | 2017.03.03 |
---|---|
커서치면 아래에 뜨게 하기 (0) | 2016.08.12 |
인터넷 익스플로러에서만 개체가 'includes' 속성이나 메서드를 지원하지 않습니다 에러 발생 (1) | 2016.07.12 |
자바스크립트 체크박스의 .attr(), .prop() 차이는 뭘까? (0) | 2016.07.07 |
Ajax (0) | 2016.05.12 |