Closed Tol1 closed 11 years ago
Sounds good. Something like this?
<div class="template">
<input type="checkbox" name="foo" value="Foo" />
<input type="checkbox" name="bar" value="Bar" />
</div>
data = {
foo: true,
bar: false
};
$('.template').render(data);
<div class="template">
<input type="checkbox" name="foo" value="Foo" checked />
<input type="checkbox" name="bar" value="Bar" />
</div>
Yeah, something like that
While other input fields are supported, checkboxes are not rendered correctly. When rendering checkbox, the
value
-attribute is set. Pre-checked<input type="checbox">
relies onchecked
-attribute instead ofvalue
.value
is used as "value of checked checkbox".My opinion is that logically
true
-value from model should setchecked
-attribute when rendering.