-
To uncheck all the checkboxes (as the title asks):
$('#termSheetPopup').find('input[type=checkbox]:checked').removeAttr('checked');
To delete all the checkboxes (as the question asks):
$('#termSheetPopup').find('input[type=checkbox]:checked').remove();
讨论(0)
-
Another approach would be:
Assign a class(just to use as a selector) to each checkbox,
<div id="termSheetPopup">
<div style="text-align:center;">
<select id="termSheetType">
<option>Internal</option>
<option>Borrower Facing</option>
</select>
</div>
<input type="checkbox" class="chk" name="SummaryInformation">Summary Information<br />
<input type="checkbox" class="chk" name="ProductLegs">Product Legs<br />
<input type="checkbox" class="chk" name="AmortizationOptions">Amortization Options<br />
<input type="checkbox" class="chk" name="Values">Values<br />
<input type="checkbox" class="chk" name="Rates">Rates<br />
<input type="checkbox" class="chk" name="RatesSpecific">Rates (All-In-Rate, PV01)<br />
<input type="checkbox" class="chk" name="AmortizationSchedule">Amortization Schedule<br />
<input type="checkbox" class="chk" name="SponsorInfo">Sponsor/Affiliate Info<br />
<input type="checkbox" class="chk" name="BorrowerInfo">Borrower Info<br />
<input type="checkbox" class="chk" name="SponsorContacts">Sponsor/Affiliate Contacts<br />
<input type="checkbox" class="chk" name="CashFlows">Cash Flows<br />
<input type="checkbox" class="chk" name="PrePayment">Pre-Payment<br />
<input type="checkbox" class="chk" name="FutureExposure">Potential Future Exposure<br />
<input type="checkbox" class="chk" name="FutureExposureSpecific">Potential Future Exposure (Max Number and Date Only)<br />
<input type="checkbox" class="chk" name="History">History<br />
And use below line to check all checkboxes:
$('.chk').attr("checked", true);
For deleting, I guess you want to delete checkbox along with the title. Insert them into a div with some id. And remove that div:
<div id="someid"><input type="checkbox" class="chk" name="SummaryInformation">Summary Information</div>
Use below code to delete:
$('#someid').remove()
This will remove checkbox as wel as the text since the div is removed.
讨论(0)