This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have an array of data. Each array element will be data for a TD in a table. I am using the DOM to create my TBODY with all the rows and data. The problem is that the first elements in the array is actually a string of text containing a link. So it looks like
The problem is that using document.createTextNode and passing in that value it is just displaying plain text. The next problem is that simply using document.createElement("A") and creating the link that way won't work because I can't always be sure that the link will appear as the first element in the array as I am not the only one using this function. Does anyone know what I might be able to do to solve my issues?
Originally posted by Bear Bibeault: If you've already got pre-formatted HTML, use innerHTML rather than DOM manipulation.
Well, that's the problem. For some reason I am having issues with IE an innerHTML when I try and add text to the tbody of a table. I can some obscure "runtime error". Firefox works great. So I switched to this method to see if I could solve the problem this way, and then of course ran into other problems.