Adding to the DOM via Prototype works in Chrome but not Firefox?
- by zaczap
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.