dongqigu0429 2014-12-03 16:59
浏览 27
已采纳

单击按钮的自定义iCheck设计可防止单击时输出总价

I was trying to understand why is it that when I click my radio button, I do not see the output of the total price, but when I ran my code in jsfiddle or in a seperate test.php page where I did not refer the script for the iCheck, the total price output was showing. How does the design of the iCheck interfere? And how can I fix this issue?

icheck.js

 $(document).ready(function(){
  $('input').iCheck({
   checkboxClass: 'icheckbox_square-blue',
   radioClass: 'iradio_square-blue',
  increaseArea: '20%' // optional
 });
});

price.js //outputs the Total price when the radio button is clicked

  $(document).ready(function(){
  //alert();
     $(document).on("click", ".btn-checkbox-plan", function(e){
       if($(".btn-checkbox-plan").is(':checked')){

        $("#output").html($(this).val());
       }

     });  

    });

Code:

<div class="checkout">
                    <span id="checkout-title">Checkout</span>
                    <div class="plan-wrapper">
                        <input class="btn-checkbox-plan" type="radio" name="groupnine" value="$699" /> <label id="silver-plan">Silver Plan</label>
                        <label id="silver-plan-price">$699</label>
                        <input class="btn-checkbox-plan" type="radio" name="groupnine" value="$999" /> <label id="gold-plan"> Gold Plan</label>
                        <label id="gold-plan-price">$999</label>
                    </div>
                    <div class="logo-wrapper">
                        <span id="personalized-logo">Personalized Logo</span>
                        <span id="logo-price">$49.99</span>
                    </div>
                    <div class="tax-wrapper">
                        <div class="wrapper-a">
                            <span id="tax">Tax + Processing</span>
                            <span id="tax-price">$0.00</span>
                       </div>
                    </div>
                    <div class="total-wrapper">
                        <div class="wrapper-b">
                            <span id="total">Total</span>
                            <output type="number" name="price" id="output"></output>
                        </div>
                    </div>
                    <div class="controls submit-btn">
                        <input  type="submit" value="Checkout" />
                        <input  type="reset" value="Clear" />
                    </div>
                    <div class="controls back-btn">
                        <input  class="back-button" type="button" value="Back" />
                    </div>
                </div>
  • 写回答

1条回答 默认 最新

  • duangu3620 2014-12-03 17:05
    关注

    You need to use the callbacks http://fronteed.com/iCheck/

    $('input').on('ifChecked', function(event){
      alert(event.type + ' callback');
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测