동적으로 생성 된 양식 시스템이 있습니다.DIV를 클릭하지 않고 숨기기
아래 코드는 캘린더를 호출하는 버튼입니다.
<input id="btn1_0" type="button" value="☵" class="rsform-calendar-box btnCal rsform-calendar-button btn btn-default" onclick="RSFormPro.YUICalendar.showHideCalendar('cal1_0Container');">
위의 버튼을 클릭했을 때 표시되는 div는 다음과 같습니다. 이 DIV 내에서 클릭 할 때이 버튼은 스타일 display:none
을 전환 :
<div id="cal1_0Container" style="clear: both; position: absolute; z-index: 9987;" class="yui-calcontainer single">
Calendar Here
</div>
나는 사람이 너무 사업부의 외부를 클릭하면 달력을 숨길.
이 JS를 시도했지만 div에 display:none
을 설정하면 작동하지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까? 내가 무엇을 달성 할 수있는 예를 찾아 당신의 YUICalendar 라이브러리를 사용하려는 경우에이 https://developer.yahoo.com/yui/calendar/
@ 공식 문서를 살펴보고 혜택을 누릴 수처럼 보이는
jQuery(document).click(function(event) {
if (!jQuery(event.target).hasClass('yui-calcontainer')) {
jQuery(".yui-calcontainer").hide();
}
});
은 알려주세요. –