I have a variable for example named "elem" , "elem" may be head, body and foot;
I want to create html element with for example;
if elem == "body"
"t" + elem => tbody html element
if elem == "head"
"t" + elem => thead html element
if elem == "foot"
"t" + elem => tfoot element
I tried many combination but not able to that. How can implement this case?
Try something like this (I assume elem = "foot"
in this case):
- var tag = "t" + elem;
table
thead
tbody
#{tag}
should render:
<table>
<thead></thead>
<tbody></tbody>
<tfoot></tfoot>
</table>
But keep in mind this table is not html conform. It's just for demonstration.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.