lee lee - 1 year ago 98
Javascript Question

IE forced to compatibility mode

I have a popup with over 1500 checkboxes, after checking the checkboxes when the user closes the popup the list of checked checkboxes are populated on the main page. This functionality is working fine. The problem occurs when the user selects a lot of checkboxes say over 600-700 checkboxes, in this case a huge amount of HTML is injected into the DOM. This forces IE to compatibility mode. Has anyone faced such a situation? How can i solve it? removing this functionality or reducing the number of checkboxes is not an option.

Very simple code to inject HTML:

$("#" + DestDiv).html(listString);

And the generated HTML is perfect, I crosschecked it.

Answer Source

To make Internet Explorer not go to the Compatibility mode, please use a <!DOCTYPE ...>

Good to use this doctype, if you are not sure.

<!DOCTYPE html>