2012-06-20 2 views
0

Here은 바이올린입니다. 사용자가 범위를 선택하도록 허용하려고합니다. (선택하면 여러 번) 시간 프레임 내의 위치를 ​​보여줍니다. 변경 날짜에도 불구하고 시작 날짜 입력 범위를 두 번 이상 사용할 수 없습니다. 시작일 선택기 코드는 다음과 같습니다.시작 날짜 범위의 JQuery show()/hide() selector

//start selector functionality 
    $('#startdate').on('change', function() { 
     var $formelem = $(this); 
     // Hide all positions that end before the specified date. 
     $('section.position time.start').each(function() { 
      if (compareTime($(this).attr('datetime'), $formelem.val()) <= 0) { 
       $(this).parent().hide(); 
      } else { 
       $(this).parent().show(); 
      } 
     }); 
     $('section.company > time').remove(); 
     $('section.company').each(processCompanyTime); 
    }); 

두 번 이상 작동하지 않는 단서는 무엇입니까? 마지막 셀렉터는 여러 번 작동합니다.

답변

1

section.company을 숨기고 표시하지 않는 조건이있는 processCompanyTime 함수에 문제가 있습니다. 그래서 그것이 숨겨 졌을 때, 결코 다시는 보이지 않을 것입니다. 발

+0

: 경우 (start.length == 0 && end.length == 0) { \t \t \t \t $ (이) .hide(); \t \t \t} 행 : 경우 (start.length == 0 && end.length == 0) { \t \t \t \t $ (이) .hide(); \t \t \t} 다른 { \t \t \t \t $ (이) .show(); \t \t \t} 고맙습니다! –