How do I properly define radio buttons using Maquette so the text will render? If I use a <p>
element the text appears, but on a new line.
var h = maquette.h;
var dom = maquette.dom;
document.addEventListener('DOMContentLoaded', function () {
var form = h("form", [
h("input", {type: "radio", value: "5", name: "freq"}),
h("p", ["5 Hz"]),
h("input", {type: "radio", value: "10", name: "freq"}),
h("p", ["10 Hz"]),
h("input", {type: "radio", value: "15", name: "freq"}),
h("p", ["15 Hz"]),
]);
document.body.appendChild(dom.create(form).domNode);
});
<script src="//cdnjs.cloudflare.com/ajax/libs/maquette/2.4.1/maquette.min.js"></script>
However, if I use a <br>
element, the text doesn't appear.
var h = maquette.h;
var dom = maquette.dom;
document.addEventListener('DOMContentLoaded', function () {
var form = h("form", [
h("input", {type: "radio", value: "5", name: "freq"}),
h("br", ["5 Hz"]),
h("input", {type: "radio", value: "10", name: "freq"}),
h("br", ["10 Hz"]),
h("input", {type: "radio", value: "15", name: "freq"}),
h("br", ["15 Hz"]),
]);
document.body.appendChild(dom.create(form).domNode);
});
<script src="//cdnjs.cloudflare.com/ajax/libs/maquette/2.4.1/maquette.min.js"></script>
What am I doing wrong?
` tags are standalone, they don't render text. and `
` tags are `display: block` so they render on separate lines. Try using a `` tag or something.
– Patrick Roberts Sep 17 '17 at 06:29