2011-02-10 11 views
0
function GenerateTermSheet() 
     { 
      var urlString = "<%= System.Web.VirtualPathUtility.ToAbsolute("~/mvc/Indications.cfc/RenderPartialTermSheetView/")%>" 
      $("#termSheetPopup checkbox:checked").each(function(){ 
       alert("Clicked"); 
       var json = 
       { 
        id : GetGUIDValue(), 
        name : $(this).attr("name") 
       } 
       $.ajax({ 
        type: "POST", 
        url: urlString, 
        data: json, 
        success: function(data) { 

        } 
       }); 

      }) 
     } 

경고가 표시되지 않습니다. 내가 위의 모든 줄에 그것을 넣으면 그것이 나타납니다. 그래서 추측하고있는 체크 박스의 루프에 문제가 있다는 것을 압니다. 이 일을 제대로하고 있습니까? 다음은 반복되는 div입니다.JQuery 확인란이 작동하지 않습니다.

<div id="termSheetPopup"> 
         <div style="text-align:center;"> 
          <select id="termSheetType"> 
           <option>Internal</option> 
           <option>Borrower Facing</option> 
          </select> 
         </div> 
         <input type="checkbox" name="SummaryInformation">Summary Information<br /> 
         <input type="checkbox" name="ProductLegs">Product Legs<br /> 
         <input type="checkbox" name="AmortizationOptions">Amortization Options<br /> 
         <input type="checkbox" name="Values">Values<br /> 
         <input type="checkbox" name="Rates">Rates<br /> 
         <input type="checkbox" name="RatesSpecific">Rates (All-In-Rate, PV01)<br /> 
         <input type="checkbox" name="AmortizationSchedule">Amortization Schedule<br /> 
         <input type="checkbox" name="SponsorInfo">Sponsor/Affiliate Info<br /> 
         <input type="checkbox" name="BorrowerInfo">Borrower Info<br /> 
         <input type="checkbox" name="SponsorContacts">Sponsor/Affiliate Contacts<br /> 
         <input type="checkbox" name="CashFlows">Cash Flows<br /> 
         <input type="checkbox" name="PrePayment">Pre-Payment<br /> 
         <input type="checkbox" name="FutureExposure">Potential Future Exposure<br /> 
         <input type="checkbox" name="FutureExposureSpecific">Potential Future Exposure (Max Number and Date Only)<br /> 
         <input type="checkbox" name="History">History<br /> 
        </div> 

감사합니다.

편집 : 여기 GenerateTermSheet을 (호출

) : 내 의견에서 언급 한 바와 같이

$('#termSheetPopup').dialog({ 
      modal: true, 
      resizable: false, 
      title: 'Generate Term Sheet', 
      width: 375, 
      height: 425, 
      autoOpen: false, 
      buttons: { 
       "Generate": function() { 
        GenerateTermSheet(); 
       }, 
       "Cancel": function() { 
        $(this).dialog("close"); 
       } 
      } 
     }); 
+0

어디에서'GenerateTermSheet() '를 호출합니까? – Dutchie432

+0

추가되었지만 urlString을 설정 한 후 경고 할 수 있기 때문에 제대로 호출됩니다. – slandau

+0

덧붙여서 ... 가 닫는 태그없이 작동하더라도, 닫지 않는 것은 아닙니다 ... 항상 태그를 닫는 것이 좋은 습관입니다. – Mash

답변

1

키 라인에게 있습니다 선택자 :

$('#termSheetPopup input[type=checkbox][checked]') 
+0

알았다. 선택기가 잘못되었습니다. – slandau

0

, 당신은 결코 때의 기능을 실행하는 JS 이야기하지 않습니다. 내 라이브 데모보기. 내가 ASP 물건을 떼어 내면 괜찮아 보인다.

#termSheetPopup input[type="checkbox"]:checked 

어쩌면이 링크를 지원합니다 : http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/

+0

내가 그렇게하면 저를 위해 일하지 않습니다 =/ – slandau

+0

... 무엇을한다면? – Dutchie432

+0

JQuery 대화 상자의 버튼을 클릭하면 제대로 작동합니다. 함수의 첫 번째 줄에 경고가 표시되면 나는 그것을 볼 수 있음을 알 수 있습니다. 그러나 선택기 밑으로 이동하면 나타나지 않습니다. – slandau

0

가 변경 시도

http://jsfiddle.net/db4Uf/1/

이 다음 selctor을 시도 할 수

//When an input in termSheetPopup is clicked, call GenerateTermSheet() 
$('#termSheetPopup input').click(function(){ 
    GenerateTermSheet(); 
}); 
+0

나는 당신이'[checked]'대신에': checked'를 의미한다고 생각한다. – Blazemonger

0

시도하십시오 (추가 콜론에 유의하십시오.) :checkbox:checked

0
$(document).ready(function() { 
    $('#selecctall').click(function(event) { //on click 
     if(this.checked) { // check select status 
      $('.checkbox1').each(function() { //loop through each checkbox 
       this.checked = true; //select all checkboxes with class "checkbox1"    
     }); 
    } else { 
     $('.checkbox1').each(function() { //loop through each checkbox 
      this.checked = false; //deselect all checkboxes with class "checkbox1"      
     });   
    } 
}); 

});

+0

코드 스 니펫이 무엇을 설명 할 수 있는가? – GHC

관련 문제