<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>¿Cuál es el JQuery para eliminar todas esas casillas de verificación justo debajo de ese div?
Para desmarcar todas las casillas de verificación (como pide el título):
$('#termSheetPopup').find('input[type=checkbox]:checked').removeAttr('checked');Para eliminar todas las casillas de verificación (como dice la pregunta):
$('#termSheetPopup').find('input[type=checkbox]:checked').remove();Otro enfoque sería:
Asigne una clase (solo para usar como selector) a cada casilla de verificación,
<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 />Y use la siguiente línea para marcar todas las casillas de verificación:
$('.chk').attr("checked", true);Para eliminar, supongo que desea eliminar la casilla de verificación junto con el título. Insértelos en un div con alguna identificación. Y elimina ese div:
<div id="someid"><input type="checkbox" class="chk" name="SummaryInformation">Summary Information</div>Use el siguiente código para eliminar:
$('#someid').remove()Esto eliminará la casilla de verificación, así como el texto, ya que se elimina el div.