Adding to the DOM via Prototype works in Chrome but not Firefox?
Posted
by zaczap
on Stack Overflow
See other posts from Stack Overflow
or by zaczap
Published on 2010-06-16T18:29:57Z
Indexed on
2010/06/16
18:32 UTC
Read the original article
Hit count: 174
I've been working on some Javascript code to add rows to a table dynamically (a small task management system) and it works perfectly in Chrome but not in Firefox. Code in question:
var task = new Element('tr', {id:arg});
task.innerHTML = "<td class='notes'>asd</td><td class='check'>*</td>";
//task.innerHTML = "<td class='notes'> </td><td class='check'><input type='checkbox' onclick=\"javascript:complete('"+task.id+"')\" /></td><td class='description'>asd</td><td class='start'> </td><td class='due'></td>";
$('tasks').insert(task);
// the commented line above is what the code was originally that does work in chrome
When I look at the HTML model in the Firefox debugger, all that is added is:
<tr id="arg"><td>asd*</td></tr>
Figuring that Chrome might be better at interpreting innerHTML into DOM elements than Firefox, I changed the code to make td elements and add them to my tr element but that didn't improve the situation at all.
© Stack Overflow or respective owner