SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery - Firefox working, IE not

    Not sure if this is a jQuery or an ASP.NET question. On http://www.franciscosautorepair.com/...rd-brakes.aspx (and similar pages) I've inserted a coupon image after the first H2 on each page and it is showing up in FF but not in IE. I am wondering if somehow the .NET code is messing up the jQuery code in IE. I'm more of a PHP programmer but I started working on this site after somebody had already built it in .NET.
    Last edited by MauiMan2; May 28, 2010 at 15:16. Reason: quick spelling correction

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,014
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    I suspect it may be the image itself. I see this javascript code
    Code JavaScript:
    $('<div style="margin-left: 11px; float: right;">
    <img src="images/automotive-repair-huntington-beach-coupon-franciscos-auto-repair.png" alt="" />
    </div>').insertAfter("H2:first-of-type");
    If you temporarily try inserting a jpg file instead of a png does it work?

  3. #3
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,873
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    .NET code very rarely causes issues with browser compatibility. Unless your outputting client side code from .net. It is giving jquery error in my IE8. So check that out. The jQuery posted above does not look right to me. You should be targeting images with attributes such as a class or ID.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,014
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    I took a look at the view-source using Firefox
    HTML Code:
    <h2>Ford Radiator Repair Huntington Beach</h2>
    <br />
    There was nothing inserted after the h tag.

    Ill move the thread over to javascript.

  5. #5
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,873
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    The problem is that your code looks to be the wrong way around.

    Try this:

    Code javascript:
    $('H2:first-of-type').insertAfter('<div style="margin-left: 11px; float: right;">
    <img src="images/automotive-repair-huntington-beach-coupon-franciscos-auto-repair.png" alt="" />
    </div>');

  6. #6
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,031
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by NightStalker-DNS View Post
    The problem is that your code looks to be the wrong way around.

    Try this:

    Code javascript:
    $('H2:first-of-type').insertAfter('<div style="margin-left: 11px; float: right;">
    <img src="images/automotive-repair-huntington-beach-coupon-franciscos-auto-repair.png" alt="" />
    </div>');
    insertAfter
    You're the one doing it the wrong way around
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  7. #7
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Changing it to JPG didn't help anything. It looks like IE doesn't like the code in the Google-hosted jQuery file. Still investigating...

  8. #8
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, problem solved when I changed
    Code:
    :first-of-type
    to
    Code:
    :first
    in the jQuery code. Guess I'm getting my CSS/jQuery pseudo-selectors mixed up.
    Last edited by MauiMan2; Jun 1, 2010 at 11:14. Reason: spelling correction


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •