1. 程式人生 > >js勾選checkbox,按鈕可按

js勾選checkbox,按鈕可按

變色 訂單 blank http put box label ace submit

技術分享

主要實現jquery方法,勾選checkbox後按鈕變色並且除去disabled

 $(function () {
        $(‘.pricing-box‘).click(function () {
            $(this).addClass("select").siblings().removeClass("select");
        })
        $(".agree-choose input[type=‘checkbox‘]").change(function () {

            if ($(this).is(‘:checked‘)) {
                $(
"#submit-btn").removeClass("disabled"); } else { $("#submit-btn").addClass("disabled"); } }) })

<div class="agree-service-wrap">
                <input type="checkbox" name="enableDiscount" class="price-factor hide">
                <
div class="agree-choose pull-right checkbox"> <label> <input id="agree-choose" name="agree-choose" type="checkbox" class="ace"> <span class="lbl"> <span class="agree-use">我已閱讀並同意簽署</span><a href=""
target="_blank">《服務協議》</a></span> </label> </div> </div>

<footer class="order-price pull-right"><input type="hidden" name="costTotal" class="cost-total" value="0">
  <div class="price-total">
  <span class="price-label">總計:</span><span class="price">¥ 2490</span>
     <p>購買後店鋪可容納10個成員</p>
     <p> 到期時間為2018年5月22日</p>
   </div>
  <div class="order-submit"><a id="submit-btn" href="payment-order.html" type="button" class="btn btn-primary disabled btn-round">提交訂單</a></div>
</footer>

js勾選checkbox,按鈕可按