<script type="text/javascript"> $(function(){ aa = $(".hide").text(); document.title= "test | "+aa+"" $('.tab a').each( function() { if (aa == $(this).text()) { {$(this).addClass("actives"); }) }) </script><div class="sub_head sub_head_bg5"> <p class="sub_head_txt upper">test</p> <h2 class="sub_head_tit">test</h2> <ul class="tab tab2 after"> <li class="tab_li"> <a href="/bbs/board.php?bo_table=notice" title="공지사항"> 공지사항 </a> </li> <li class="tab_li"> <a href="sub5_1.php" title="온라인상담"> 온라인상담 </a> </li> <li class="tab_li last"> <a href="sub5_2.php" title="오시는길"> 오시는길 </a> </li> </ul></div>
탭 파일을 인쿠르트하고,
페이지마다 타이틀을 본문의 hide의 텍스트로 변경하고,
탭의 a태그와 hide와 비교해서 같다면
addClass를 하라는 스크립트를 사용하고 있습니다.
기존의 페이지에서는 잘 활용했는데,
새로운 페이지에 적용하려니까 타이틀은 바뀌는데 if 문이 먹지를 않습니다.
콘솔창에 오류도 뜨지 않고요,
혹 오류를 찾는방법이나, 다른 방법이 있다면 도움을 받을 수 있을까요? ㅠㅠㅠㅠ
제발요,,,
답변 1개 / 댓글 1개
$(function(){
aa = $(".hide").text();
document.title= "test | "+aa+""
$('.tab a').each( function() {
if (aa == $(this).text()) {
$(this).addClass("actives");
}
});
});
괄호가 이상하게 되어 있네요.
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.