Is there a way to assign a variable to the element name so that I can access the element and change the value:
[% FOREACH field IN ['id','type','updatedt','lastcheckdt'] %] <div class="row col-md-3 col-sm-6"> <dl class="details-dl"> <label>[% field %]</label> <div class="details-dg"> <dd name=[% field %] class="float-right">[% order.$field %]</dd> </div> </dl> </div> [% END %]
I can format the updated datetime:
let dt_formatted = convertDateFormat("[% order.updatedt %]"); $( "[name='updatedt']" ).val(dt_formatted);
Unfortunately, assigning [ % field %] to the name does not assign any value to the name:
<dd name=[% field %] class="float-right">[% order.$field %]</dd>
Use .html() instead of .val to access properties in
Looks like you're missing quotes here: