Bug Tracker

Opened 10 years ago

Closed 10 years ago

#5317 closed bug (invalid)

cannot insert unclosed tag using .html() function (bug?)

Reported by: emil Owned by:
Priority: minor Milestone: 1.3.2
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

code:

<html> <head>

<script src="jquery.js"></script> <script type="text/javascript">

$(document).ready(function(){

$("#start").html('<a href="#">pre'); $("#stop").html('after</a>');

});

</script>

</head> <body> <span id="start"></span>-link-<span id="stop"></span> </body> </html>

expect to have "pre-link-after" link but only "pre" is link in FF 3.5.3 and Opera 9.64 nothing is marked as a link on IE 8.0

Change History (1)

comment:1 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

Nope, it doesn't work that way. The argument to .html() needs to be a valid complete html fragment. Your examle is built as if you're tacking parts of strings together to build html. To learn more, study some jQuery code examples and ask questions on the forums.

Note: See TracTickets for help on using tickets.