如何在文档中使用jQuery或d3js在dl dt结构后面的DOM中替换为动态表行将具有任何顺序的数据元素,并且缺少一些列...
发件人>>
<dl class="table"> <dt class="row">1</dt> <dd> <dl> <dt>name</dt> <dd>Tom Cruise</dd> <dt>age</dt> <dd>56</dd> </dl> </dd> <dt class="row">2</dt> <dd> <dl> <dt>dob</dt> <dd>April 4, 1965</dd> <dt>name</dt> <dd>Robert Downey Jr.</dd> <dt>age</dt> <dd>53</dd> </dl> </dd> </dl>
To
<table>
<thead>
<tr>
<th>s.no</th>
<th>name</th>
<th>age</th>
<th>dob</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Tom Cruise</td>
<td>56</td>
<td></td>
</tr>
<tr>
<td>2</td>
<td>Robert Downey Jr.</td>
<td>53</td>
<td>April 4, 1965</td>
</tr>
</tbody>
</table>
<< [ >$('button').click(() => {
const newTable = $('#new-table');
newTable.show();
$('dl').replaceWith(newTable);
});