javascript - JQuery insertAfter in chrome & safari causes the content to be inserted as String -


I am using jQuery to dynamically insert rows in a table, the row is the one (text) template , Which replaces some things, then 'fakes' in a 'jQuery DOM node'. While it works fine in Firefox and IE:

  jQuery (jQuery.parseHTML (node)). InsertAfter ("# imgTable tr: last ()");   

Do not include the Chrome and Safari nodes, but insert HTML as a string. In this way I'm not getting a line, a solid block bug of html sourcecode ... which is a UX disaster :)

Very simple breeding:


..i.i already found out that the source of the error is that I have my template and lt; Noscript & gt; I have to store this inside the tag, because all other tags that I know are i translated, so most browsers are either & lt; Tr & gt; and & lt; Td> Remove the tag or otherwise modify the content.

Storing the template in any variable is not an option, because the template already contains some backend generated data, so the real question is: How do I interpret the data after inserting a webkit browser Can i Or: How do I store templates by other means?

HTML code -

  & lt; Table id = "table" & gt; & Lt; TR & gt; & Lt; Th & gt; BSP & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; Noscript id = "tpl" style = "display: none" & gt; & Lt; TR & gt; & Lt; TD & gt;% VAr% & lt; / TD & gt; & Lt; / TR & gt; & Lt; / noscript & gt;   

jQuery code -

  var node = $ ("# tpl"). Text (); Node = node Location ("% VAR%", "test"); $ ($ .pars HTML (node)). InsertAfter ("# Table tr: last ()"); JSFiddle -  

This solution is working fine in all browsers.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -