Change Font Size For A Field Within A Script

Hi,

I need to change the font size of a single field in a address block. I thought the below would work as a long shot. Can someone advise a method?

var field, field2, result = “”;

field = record.fields[“Prefix”];
if (field !== “”) result += field + " ";
field = record.fields[“Firstname”];
if (field !== “”) result += field + " ";
field = record.fields[“Lastname”];
if (field !== “”) result += field + “<br>”;
field = record.fields[“Company”];
if (field !== “”) result += field + “<br>”;
field = record.fields[“Add1”];
if (field !== “”) result += field + “<br>”;
field = record.fields[“Add2”];
if (field !== “”) result += field + “<br>”;
field = record.fields[“Add3”];
if (field !== “”) result += field + “<br>”;
field = record.fields[“City”];
if (field !== “”) result += field + “<br>”;
field = record.fields[“County”];
if (field !== “”) result += field + “<br>”;
field = record.fields[“PCode”];
field2 = record.fields[“SortCode”];
field2.fontsize(“6pt”);
if (field !== “”) result += field + " " + field2 + “<br>”;

field = record.fields[“Country”];
if (field !== “” && field !== “Great Britain”) result += field;

results.html(result);

I need the address block to look like this. With the 31303 been 6pt while the rest of the address/fields been 11pt.

IV12 4HZ 31303
Great Britain

I would usually add another text script and add its selector next to the address block selector but since country is dynamic I cannot get the desired result.

Regards,

S

You can enclose in a html element and set the style on that element.

For example, enclose it inside a <span> like this:

var field2 = record.fields[“SortCode”]
field2= ‘<span style=“font-weight: bold; font-size:8px; color:red;”>’ + field2 + ‘</span>’;

Easy enough I see. Thanks Rod!