3

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:

$(".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>
hopper
  • 13,060
  • 7
  • 49
  • 53
Sotiris
  • 38,986
  • 11
  • 53
  • 85

2 Answers2

6

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.

Radu
  • 8,561
  • 8
  • 55
  • 91
0

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

$(document).ready(function() {
Chris Fletcher
  • 2,367
  • 1
  • 16
  • 19