I have the following template in my markup.
<template id="unsequenced-template">
<button type="button" class="btn btn-primary railcar"></button>
</template>
And then I insert it into my DOM something like this.
// Inserts a railcar in the unsequenced list before the specified target
function addSequenced(railcar, $target) {
var $clone = $($('#unsequenced-template').html());
$clone.attr('data-id', railcar.id);
$clone.text(railcar.number);
$clone.insertBefore($target);
modified = true;
}
This works, but there is zero spacing between buttons inserted this way. I even tried first appending a space to the $clone
but it has no effect. I also tried adding whitespace in the template, but that had no effect either.
Some buttons are added on start. They are one per line, and those show a space between buttons. But how can I show spaces between the buttons inserted using JavaScript?