Bug Tracker

Opened 11 years ago

Closed 11 years ago

#10913 closed bug (invalid)

jQuery.html() - removes double spaces on IE7 and IE8

Reported by: Agnius101 Owned by:
Priority: low Milestone: None
Component: manipulation Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


  1. Set html value with double spaces:

$("#list").html('<li>List item with double spaces.</li>');

  1. Get html value:


  1. html() function returns value without double spaces on IE7 and IE8, while it returns expected value on IE9, FF and Chrome.

See example on and check console output: http://jsfiddle.net/L6zq6/1/

Change History (1)

comment:1 Changed 11 years ago by sindresorhus

Component: unfiledmanipulation
Priority: undecidedlow
Resolution: invalid
Status: newclosed

This is not a jQuery issue. Using alert( document.getElementById("list").innerHTML ); alerts the same thing on IE7/8

You could of course use <pre> or CSS white-space: pre to keep the whitespace. You could also replace the whitespace with the whitespace entitity &nbsp;

Note: See TracTickets for help on using tickets.