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>
5
  • why downvotes? :O and without reasoning..is something wrong with the question? Commented Nov 4, 2010 at 20:18
  • I think it was because you didn't post any code and you didn't explain what you did. I voted you up :) Commented Nov 4, 2010 at 20:20
  • 1
    @Sotiris well I did not downvote, but perhaps people were concerned about the wording of the title. I think it's really a wasted opportunity to downvote without explaining why however. Commented Nov 4, 2010 at 20:20
  • Also it would help if you would say which version of IE is causing you problems. Commented Nov 4, 2010 at 20:21
  • @Pointy I have the problem with ie 7,8 Commented Nov 4, 2010 at 20:27

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

$(document).ready(function() {

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.