2011-03-16 3 views

답변

3

:

$(function() { 
    if (location.href.match(/\_edit/)) { 
     $('div#editor').show(); 
    } 
    else { 
     $('div#editor').hide(); 
    } 
}); 

클릭 핸들러를 통해 :

그냥 표시하거나 사업부를 숨길 지 여부를 선택합니다 HREF에 문자열 일치 방법을 사용합니다.

$('a').click(function() { 
    var href = $(this).attr('href'); 
    if (href.match(/\/_edit/)) { 
     $('div#editor').show(); 
    } 
    else { 
     $('div#editor').hide(); 
    } 
}); 
+0

죄송합니다.로드 할 때 페이지로드가 발생했습니다. – Jake

+0

@Jake - 문서 준비 처리기 안에있는 클릭 된 앵커의 href 대신 'location.href'에만 문제가 없습니다. – tvanfosson

+0

schwee 감사합니다! 아프다. – Jake