开发者

Creating valid XHTML when using jQuery .append()

开发者 https://www.devze.com 2023-03-30 19:14 出处:网络
In the examples here:http://api.jquery.com/append/they show straight HTML being used as an argument: $(\'.inner\').append(\'<p>Test</p>\');

In the examples here: http://api.jquery.com/append/ they show straight HTML being used as an argument:

$('.inner').append('<p>Test</p>');

But the validator at W3 will object to this like so

Line 96, column 76: document type does not allow element "p" here
…ata).append("<p class='pag

How should I do this to get valid XHTML?

EDIT - Here is an example of what is written by PHP:

$('#citations_18401-01').html(data).append("开发者_JS百科<p class='paginated_link'><b>Result Pages:</b>&nbsp;<b class='paginated_link'>1</b>&nbsp;<a class='paginated_link' href='property_info.php?lot=18401-01&quote_set=1&limit=30&tab=3'>2</a>&nbsp;</p><p>&nbsp;</p>"); 


You have to wrap your inline jQuery with special tags for XHTML. See this article.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号