jQuery代码在IE中不起作用 [英] jQuery code not working in IE

查看:77
本文介绍了jQuery代码在IE中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是jQuery的新手,正在尝试创建此页面.在我测试过的所有浏览器中,当我单击红色按钮时,都会显示优惠券代码,但IE除外.为什么会这样?我该如何解决?

I am a novice in jQuery, and am trying to create this page. In all browsers I tested, when I click the red button a coupon code appears, except for IE. Why does this happen? And how can I fix it?

我讨厌这个浏览器,真的...

I hate this browser, really...

JavaScript:

Javascript:

$(".coupon_button").live('click', function (event) { 
    $(".coupon_button").remove().fadeOut('slow');
    $(".coupon_main").after($("<div class='coupon_code'>code:newhgcoupon</div>").fadeIn());
    //$(".coupon_main").after().fadeIn('slow').html("<div class='code'>code:newhgcoupon</div>");
});

HTML:

<div class="module">
  <div class="coupon_title">Pay <span class="yellow">1 Cent</span> your First Month</div>
  <div class="coupon_main">To help save you some time, we created a link that takes you directly to the easily missed area on the official Medifast site that lists all of their latest specials and discounts.</div>
  <div class="coupon_button"><img src="button.png" /></div>
  <div class="coupon_footer">Expiration: 11-30-2010</div>
</div>

推荐答案

您的脚本未在IE中执行.要解决此问题,只需将脚本类型更改为text/javascript.

Your script is not executing in IE. To fix it, just change the script type to text/javascript.

IE根本不将application/javascript类型识别为脚本.

IE does not recognize the application/javascript type as being a script at all.

这篇关于jQuery代码在IE中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆