Skip to main content

Bug Tracker

Side navigation

#7550 closed bug (invalid)

Opened November 18, 2010 08:31AM UTC

Closed November 18, 2010 10:34AM UTC

Different results of html() function in different browsers

Reported by: krishnafru Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:
Description

Hi,

I am facing a problem with html function. below is the code snippet:

<div id="div_container">
    <input type="text" id="txt_name" value="sample text" style="width:250px;" />
</div>

Suppose later user changed the txt_name value from "sample text" to "changed text".

Now if i call

alert($('#div_container').html());

in IE the alert window shows

<input type="text" id="txt_name" value="changed text" style="width:250px;" />

but in FF

<input type="text" id="txt_name" value="sample text" style="width:250px;" />

Attachments (0)
Change History (1)

Changed November 18, 2010 10:34AM UTC by jitter comment:1

_comment0: → 1290076673029593
_comment1: Thanks for taking the time to contribute to the jQuery project by writing a bug ticket! \ \ The [http://api.jquery.com/html/ documentation] states: \ \ > This method uses the browser's `innerHTML` property. Some browsers may not return HTML that exactly replicates the HTML source in an original document. \ \ And IE does in this case. IE seems to change the innerHTML although this shouldn't be the case. \ \ 1290076751138324
resolution: → invalid
status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug ticket!

The documentation states:

This method uses the browser's innerHTML property. Some browsers may not return HTML that exactly replicates the HTML source in an original document.

As IE does in this case. IE seems to change the innerHTML although this shouldn't be the case.