Skip to main content

Bug Tracker

Side navigation

#6559 closed bug (worksforme)

Opened May 12, 2010 12:22AM UTC

Closed May 12, 2010 02:38AM UTC

.html() function returns inconsistent results

Reported by: chris.handorf Owned by:
Priority: Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:
Description

<html>

<script src="jquery142.js"></script>

<script language="javascript">

var a = "<div>test</div>";

var b = "<p><div>test</div></p>";

var c = "<p><span>test</span></p>";

alert($(a).html()); shows "test"

alert($(b).html()); shows nothing!!

alert($(c).html()); // shows "<span>test</span>

</script>

</html>

Attachments (0)
Change History (1)

Changed May 12, 2010 02:38AM UTC by dmethvin comment:1

resolution: → worksforme
status: newclosed

a is correct. The html contents of the div element were returned.

b is invalid markup. A paragraph cannot contain a div.

c is correct. The contents of the p element were returned.

For further guidance, ask for help on the forum.

http://forum.jquery.com