admin管理员组文章数量:1292301
Folks, Im quite new to jade and bootstrap. Creating a simple form, which has dropdowns and checkboxes.
Right now my code looks as follows:
form(role="search",action='/uri/blah' method='post').navbar-form.navbar-left
.form-group
input(type="name", name="bae", placeholder="bae", required).form-control
select(id="type",name="type").form-control
option(value="foo") foo
option(value="bar") bar
option(value="baz") baz
input(type="text", name="X", placeholder="X", required).form-control
input(type="checkbox", name="checkboxname", text="asdf").form-control
p
button(type="submit").btn.btn-default Submit
Questions: 1.) Checkbox name, whats the proper syntax to label it? 2.) How to make the form more dynamic? Ie, if a checkbox is clicked or a dropdown is selected, another would appear?
Thanks
Folks, Im quite new to jade and bootstrap. Creating a simple form, which has dropdowns and checkboxes.
Right now my code looks as follows:
form(role="search",action='/uri/blah' method='post').navbar-form.navbar-left
.form-group
input(type="name", name="bae", placeholder="bae", required).form-control
select(id="type",name="type").form-control
option(value="foo") foo
option(value="bar") bar
option(value="baz") baz
input(type="text", name="X", placeholder="X", required).form-control
input(type="checkbox", name="checkboxname", text="asdf").form-control
p
button(type="submit").btn.btn-default Submit
Questions: 1.) Checkbox name, whats the proper syntax to label it? 2.) How to make the form more dynamic? Ie, if a checkbox is clicked or a dropdown is selected, another would appear?
Thanks
Share Improve this question asked Dec 31, 2013 at 1:49 CmagCmag 15.8k25 gold badges97 silver badges146 bronze badges3 Answers
Reset to default 7Unfortunately, in order to make it dynamic, you can't do it in Jade. You would have to rely on jQuery or other front-end libraries to handle that.
I label my Checkbox like this:
label(for="checkbox")
input(type="checkbox", name="checkboxname", value="value").form-control
| Checkbox Label Goes Here
If I want to set default values from the server:
label(for="checkbox")
input(type="checkbox", name="checkboxname", value="value" checked=data.checked?"checked":undefined).form-control
| Checkbox Label Goes Here
The following works: (bootstrap3)
.checkbox
label
input(type='checkbox', name='checkbox', value='test')
| check
If you're using angular this works fine
input(type="checkbox", name="myCheckbox")
label(translate="TRANSLATE_TEXT", for="myCheckbox")
本文标签: javascriptbootstrapjade checkboxStack Overflow
版权声明:本文标题:javascript - bootstrap + jade checkbox - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741545494a2384569.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论