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 8045619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:36:17+00:00 2026-06-05T05:36:17+00:00

Update: This question should be closed, as the problem was due to my own

  • 0

Update: This question should be closed, as the problem was due to my own coding error and not really useful.

I’m having problems with IE8 and jQuery.html() when there’s a leading whitespace and an anchor tag inside. To reproduce the problem, go here:

http://jquery.com/

Now enter this into the IE8 developer console:

$('body').html(' test<a href="">foo<a>');

You will notice that nothing gets printed on the screen. Entering this in the console will confirm that the content of the body is empty:

$('body').html();

If I use the native innerHTML, this problem doesn’t occur. jQuery bypasses the native innerHTML for IE8 and instead uses jQuery.append() because IE8 would strip the leading whitespace.

Anyone know why this is happening? Is this a known bug?

  • 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-06-05T05:36:18+00:00Added an answer on June 5, 2026 at 5:36 am

    Your markup is invalid, it works if you close it,

    $('body').html(' test<a href="">foo</a>');
    

    I don’t know how jQuery should handle invalid markup here though, so it might still be a bug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: This question is out of date, but left for informational purposes. Original Question
Update: This question was an epic failure, but here's the working solution. It's based
Update: This question is a duplicate of Are there any programming languages targeting PHP,
Sorry for the double post, I will update this question if I can't get
Update 2018 : This question was asked long before PostCSS existed, and I would
UPDATE (spoiler): This question is answered (see David Carlisle answere below) and it looks
UPDATE : Since this question is getting some views, I figured I'd better highlight
UPDATE : I asked this question in another form (see below), and it got
Update: See the bottom of this question for a C# workaround. Hi there, Consider
UPDATE The second after I posted this question, thanks to the syntax highlighting of

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.