I am trying to build some list elements using jQuery append(...) but I do not seem to get the syntax correct. I have come part way (with the correct output), but I am sure that there is a better way to use the function that does not require my building HTML directly from strings.
My desired result...
<a href='...;'>
<div>Wigan</div>
<div style="font-size: 8px">Wigan, null, NaN</div>
</a>
My JavaScript...
var result = $("<a>", {href: "..."});
result.append("<div>"+ results[index].Region + "</div>");
result.append("<div style = \" font-size: 8px\">" + results[index].District + ", " + results[index].Postcode + ", " + +results[index].CountryCode + "</div>");
What I have above works, but how do I group the append calls and the content to build this up without simply creating the strings as I do above?
Thanks.