【发布时间】:2020-02-12 12:54:23
【问题描述】:
试图在纯 javascript 中访问每一行的最后一列,而不是在 jquery 中但不工作。任何知道的人请帮助找到解决方案。
app.component.html:
<div id="contentId">
<table>
<thead>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</thead>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td><select><option>Select</option><option value="test1">Test 1</option><option value="test2">Test 2</option></select></td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td><select><option>Select</option><option value="test1">Test 1</option><option value="test2">Test 2</option></select></td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td><select><option>Select</option><option value="test1">Test 1</option><option value="test2">Test 2</option></select></td>
</tr>
</table>
</div>
演示:https://stackblitz.com/edit/amexio-breadcrumb-demo-jyxytf?file=src/app/app.component.ts
【问题讨论】:
-
用例是什么,为什么不在
select元素上直接定义一个更改事件监听器呢?<select (change)="getEvent($event)"> -
@uminder:请不要更改 html。可以在ts文件里做吗?
标签: javascript typescript angular7 angular8