2011-02-10 55 views
13
<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> 

什麼是JQuery刪除該div下面的所有複選框?JQuery取消選中div內的所有複選框

+0

你想要他們刪除,還是未選中? – Loktar 2011-02-10 16:20:33

+0

我的錯字。標題是正確的 – slandau 2011-02-10 16:21:56

回答

50

要取消所有的複選框(作爲標題問):

$('#termSheetPopup').find('input[type=checkbox]:checked').removeAttr('checked'); 

要刪除所有複選框(因爲這個問題問):

$('#termSheetPopup').find('input[type=checkbox]:checked').remove(); 
2

另一種方法是:

爲每個複選框分配一個類(僅用作選擇器),

,並使用下面一行檢查所有複選框:

$('.chk').attr("checked", true); 

刪除,我想你想隨標題刪除複選框。將它們插入帶有某個ID的div中。並刪除該分區:下面的代碼

<div id="someid"><input type="checkbox" class="chk" name="SummaryInformation">Summary Information</div> 

使用刪除:

$('#someid').remove() 

這將刪除複選框爲WEL以來股利被刪除的文字。

相關問題