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:
<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 :(得分:1)
您可以尝试以下选择器:
#termSheetPopup input[type="checkbox"]:checked
也许此链接会支持您:http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/
答案 1 :(得分:0)
正如我在评论中提到的,你永远不会告诉JS何时执行该功能。看我的现场演示。如果我删除ASP的东西,似乎工作正常。
这是关键线
//When an input in termSheetPopup is clicked, call GenerateTermSheet()
$('#termSheetPopup input').click(function(){
GenerateTermSheet();
});
答案 2 :(得分:0)
尝试将选择器更改为:
$( '#termSheetPopup input[type=checkbox][checked]' )
答案 3 :(得分:0)
尝试:checkbox:checked
(注意额外的冒号)。
答案 4 :(得分: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"
});
}
});
});