HTML assign variable to element name
P粉148782096
P粉148782096 2023-09-09 20:57:07
0
2
347

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>

P粉148782096
P粉148782096

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!