I am currently creating a very dynamic table for a list application that will basically perform basic CRUD functions through AJAX.
What I would like to do is separate visual design and javascript to such an extent that I can change the design side without touching the JS side. This will only work where the design remains roughly the same (I would like to use it to quickly create prototypes).
Here is an example.
<table>
<tr><td>record-123</td><td>I am line 123</td><td>delete row</td></tr>
<tr><td>record-124</td><td>I am line 124</td><td>delete row</td></tr>
<tr><td>record-125</td><td>I am line 125</td><td>delete row</td></tr>
<tr><td>add new record</td></tr>
</table>
Now when I add a new entry, I would like to insert a new html line, but I would prefer not to put this html in a javascript file.
What I am considering creates such a row on the page next to the table.
<tr style='visble:none;' id='template-row'><td>record-id</td><td>content-area</td><td>delete row</td></tr>
, , id = template-row, , , .
, - , , js.
- ?