Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7053197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:28:32+00:00 2026-05-28T03:28:32+00:00

I tried to add a conditional statement for IE7 with jQuery, but it doesn’t

  • 0

I tried to add a conditional statement for IE7 with jQuery, but it doesn’t work dynamically (if it was hardcoded it worked, so I know this is related to the way jQuery is appending the actual “comment” of the conditional statement).

The code I’m using is this:

$("head").append("<!--[if IE 7]>");
$("head").append("<link>");
css = $("head").children(":last");
    css.attr({
    rel:  "stylesheet",
    type: "text/css",
    href: "css/IE7.css"
});
$("head").append("<![endif]-->");

My thought is that this is related to the < and >, maybe these need to be urlencoded?, how?

Anyone have a solution for this that doesn’t involve targeting each CSS property with jQuery (there are tens of CSS fixes, so that won’t be a solution).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:28:33+00:00Added an answer on May 28, 2026 at 3:28 am

    You could use $.browser to check the browser version and act accordingly:

    if ($.browser.msie && parseInt($.browser.version, 10) === 7) {
        $('head').append('<link>', {
            rel:  'stylesheet',
            type: 'text/css',
            href: 'css/IE7.css'
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried the add() method but nothing is displayed when I try to add
This morning, when I tried to add a new ASPX page to my project,
PokerFrame (called from a viewer class) worked perfectly, but once I tried to convert
I just saw this thread, describing how to add conditional macros: Conditional value for
i've tried everything for the past 2 hours to get this working but my
I know this question has been asked 100x but I can't seem to find
I tried some add to favorties JavaScript scripts.. With IE8, I get an access
I tried to add buttons, textboxes and text to tableview. I want the row
I just tried (for the first time, I might add) a port upgrade installed
I want to add some html in an email. I've tried the following. vFromName

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.