开发者

jQuery code not working in 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? A开发者_开发问答nd how can I fix it?

I hate this browser, really...

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>


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

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


I think you're missing your document.ready function. Add this line right above the first line of your script:

$(document).ready(function() {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜