ember.js - Putting a texfield inside a table using Handlebars -
i new @ using handlebars, , have simple question. trying create table contains title , text field next it. when try place textfields in table, textfields placed on top of table instead.
this code using:
<!doctype html> <html> <head> <title>handlebars.js example</title> </head> <body> <div id="placeholder">this replaced handlebars.js</div> <script type="text/javascript" src="handlebars-v1.3.0.js"></script> <script id="mytemplate" type="text/x-handlebars-template"> <table> {{#each names}} <tr><th>{{name}}</th><input type="text"></tr> {{/each}} </table> </script> <script type="text/javascript"> var source = document.getelementbyid("mytemplate").innerhtml; var template = handlebars.compile(source); var data = { names: [ { name: "foo",id:'id'}, { name: "bar",id:'id' }, { name: "baz",id:'id' } ]}; document.getelementbyid("placeholder").innerhtml = template(data); </script> </body> </html> what doing wrong?
your table structure bad. you're missing tbody , input in row, not in th or td.
Comments
Post a Comment