2013-06-04 4 views
1

SQL Server에 제출하기 전에 요약 페이지를 보려면 양식 끝에 SQL Multiview를 사용하고 있습니다. 내 문제는 몇 가지 표시/숨기기 jQuery 함수를 확인란을 선택하면 있습니다. 요약에 가서 편집을 클릭하면 다시 돌아가서 .show .hide 함수에 몇 가지 문제가 발생합니다. 아래는 제가 사용하고있는 jQuery 코드입니다. 궁극적으로 최종 사용자가 선택한 상태를 유지하려고합니다 (선택 또는 선택 취소). 내가 잘못된 방향으로가는거야?asp.net MultiView에서 jQuery .show .hide 함수 사용

asp multiview를 사용하지 않고 대신 jQuery .tabs를 사용하면 텍스트 입력의 데이터를 요약 페이지의 값으로 가져 오는 방법은 무엇입니까?

jQuery를

<script type="text/javascript"> 
    function uncheck() { 
     // Uncheck all checkboxes on page load  
     $("input:checkbox:checked").attr("checked", false); 
    } 
    $(document).ready(function() { 
     $('.emsSection').hide(); 
     $('#emsYES').click(function() { 
      $('.emsSection').show(); 
     }); 
     $('#emsNO').click(function() { 
      $('.emsSection').hide(); 
     }); 
     $('.thirdPartyForm').hide(); 
     $('#thirdPartyService').click(function() { 
      var chk = $(this); 
      $('.thirdPartyForm').fadeToggle('fast', chk.attr('checked')); 
     }); 
     $(".phoneMask").mask("(999) 999-9999"); 
    }); 
</script> 

답변

0

가 문제를 해결하는 기능 pageload 대신 document.ready

합니까 내에서 자바 스크립트를 넣어보십시오?

0

내 솔루션은 jQuery 쿠키 플러그인을 사용하는 것이 었습니다. 조금 연구를 한 후에 다음을 작성하여 알아 냈습니다.

$(document).ready(function() { 

     $('.thirdPartyForm').hide(); 

     if ($.cookie('showhide') == 'showtp') { 
      $('.thirdPartyForm').show(); 
     } 

     $('#thirdPartyService').click(function() { 
      if ($(this).is(':checked')) { 
       $(".thirdPartyForm").show(); 
       $.cookie('showhide', 'showtp'); 
      } 
      else { 
       $(".thirdPartyForm").hide(); 
       $.cookie('showhide', null); 
      }; 
     }); 
     $('.emsSection').hide(); 

     if ($.cookie('emsservice') == 'showems') { 
      $('.emsSection').show(); 
      } 

      $('#emsYES').click(function() { 
       $('.emsSection').show(); 
       $.cookie('emsservice', 'showems'); 
      }); 
      $('#emsNO').click(function() { 
       $('.emsSection').hide(); 
       $.cookie('emsservice', null); 
     }); 
    });