You have too many opening
<dl>
tags. Remove the extras.
Also, you have the wrong "slash" in the closing tag - it needs to be
</dl>
, not
<\dl>
.
var result = ""
result += "<dl> \n";
result += " <dt>normal</dt> \n ";
result += " <dd>" + normal + "</dd> \n";
result += " \n";
result += " <dt>password</dt> \n ";
result += "<dd>" + password + "</dd> \n";
result += " \n";
result += " <dt>secret</dt> \n ";
result += "<dd>" + secret + "</dt> \n";
result += " \n";
result += " <dt>big text</dt> \n ";
result += "<dd>" + bigText + "</dt> \n";
result += "</dl> \n";
Beyond that, you haven't actually described a problem.
If you're not happy with the layout of the
<dl>
, then use CSS to style it - eg:
dl {
display: grid;
grid-template-columns: auto 1fr;
}
dt {
text-align: right;
margin-right: 20px;
}
If that's not what you're asking, then you need to update your question to explain what the problem is.