Bug Tracker

Modify

Ticket #5317 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.