Bug Tracker

Opened 10 years ago

Closed 10 years ago

#6559 closed bug (worksforme)

.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>

Change History (1)

comment:1 Changed 10 years ago by dmethvin

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

Note: See TracTickets for help on using tickets.