Javascript在JS Fiddle中工作,但在Chrome / IE中不起作用
Javascript works in JS Fiddle but doesn't work in Chrome/IE
我不明白为什么我的代码在我的浏览器中不起作用,但它在小提琴中工作。 http://jsfiddle.net/4tafnwcj/2/
当我单击计划时,总数应输出价格,但是,这不会在浏览器中发生。我已经检查了开发工具,清除了缓存,但没有帮助。我还包含了所有必要的jquery,js文件,但似乎还有其他东西破坏了它。我不知道为什么。请帮助并解释问题所在。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="<?=SITE_SCRIPT?>jquery.validate.min.js"></script>
<script type="text/javascript" src="<?=SITE_SCRIPT?>jquery.form.js"></script>
<script type="text/javascript" src="<?=SITE_SCRIPT?>jquery.nivo.slider.pack.js"></script>
<script type="text/javascript" src="<?=SITE_SCRIPT?>bootstrap.min.js"></script>
<script type="text/javascript" src="<?=SITE_SCRIPT?>icheck.min.js"></script>
法典:
<div class="checkout">
<span id="checkout-title">Checkout</span>
<div class="plan-wrapper">
<label id="silver-plan"><input class="btn-checkbox-plan" type="radio" name="groupnine" value="699" onclick="calculate(this);"/>Cyber Security Silver Plan</label>
<label id="silver-plan-price">$699</label>
<label id="gold-plan"><input class="btn-checkbox-plan" type="radio" name="groupnine" value="999" onclick="calculate(this);"/>Cyber Security 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><!--/.checkout -->
。.js
<script>
$(document).ready(function(){
$(document).on("click", ".btn-checkbox-plan", function(e){
//alert();
if($(this).is(':checked')){
$("#output").html($(this).val());
}
});
});
</script>
我已经删除了onclick="calculate(this);",因为我不需要它,我没有什么可计算的。
http://jsfiddle.net/3tdwak2h/4/在小提琴中,我的代码运行,但是,不是在我的浏览器中。在Chrome控制台日志中,我收到的唯一错误是无法加载资源:net::ERR_CACHE_MISS
法典
<div class="checkout">
<span id="checkout-title">Checkout</span>
<div class="plan-wrapper">
<label id="silver-plan"><input class="btn-checkbox-plan" type="radio" name="groupnine" value="699" /> Silver Plan</label>
<label id="silver-plan-price">$699</label>
<label id="gold-plan"><input class="btn-checkbox-plan" type="radio" name="groupnine" value="999" /> 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>
。.js
$(document).ready(function(){
//alert();
$(document).on("click", ".btn-checkbox-plan", function(e){
if($(".btn-checkbox-plan").is(':checked')){
$("#output").html($(this).val());
}
});
});
相关文章:
- IE/Chrome中未定义的函数,但Firefox中没有
- 滚动在Chrome中有效,但在Firefox或IE中无效
- CKeditor预览插件.js,为Chrome和IE进行编辑.因为它拒绝CSS样式
- 如何编写在Chrome和IE中正常工作的JavaScript
- document.images未加载在chrome或firefox上,但已加载在IE上
- Javascript赢得'不能在IE上编译,但可以在Chrome上运行
- IE与Chrome的怪癖模式
- Json到CSV下载,可以在chrome中工作,但不能在IE浏览器中工作
- Jquery selectmenu组合框在IE和Chrome中每当按钮打开时就会关闭
- 以下颜色更改功能在IE9和Firefox中运行良好,但在早期的IE或Chrome中则不然
- window.opener not working in chrome & IE
- HTML5视频无法在chrome上工作,在服务器上托管后的IE,mov文件中的视频(quicktime格式)
- Iframe加载调整大小在Chrome中工作,但不能在IE或Firefox中工作
- AngularJS$http.post没有'不适用于Chrome,仅适用于IE
- Javascript'元素'在ie中未定义,但在chrome和firefox中运行良好
- Multi-platform (Chrome, IE, Firefox)
- Javascript在JS Fiddle中工作,但在Chrome / IE中不起作用
- jQuery:$.getJSON对Chrome/IE上的数据进行排序
- 输入元素在Firefox中没有定义,但在Chrome/IE中有
- 下拉JavaScript的onClick事件不触发Chrome/IE