【发布时间】:2013-09-15 02:19:21
【问题描述】:
我正在尝试在 HTML 表格中的 TR 中单击该元素。如果我单击 TR 内的 Select 输入,CurrentTarget 字段返回“TR”,OriginalTarget 返回“SELECT”。
这是我的 HTML:
<table id="0" class="tableEdit">
<thead>
<tr>
<th name="id"></th>
<th name="name">Descripción Registro</th>
<th name="select">Fecha</th>
</tr>
</thead>
<tbody>
<tr>
<td>1651</td>
<td>Name</td>
<td>
<select name="selectName">
<option value="1">1</option>
<option value="2">2</option>
</select>
</td>
</tr>
</tbody>
</table>
这是我的代码:
//trb is each TR element of the line
$(trb).click(function(elem){
if (elem.currentTarget && elem.currentTarget.tagName.toLowerCase() === "tr" && !isInput(elem.originalTarget)){
if (editableRow){
var rowTrigger = editableRow.find("button").get();
$.editRow(rowTrigger,$.tableEditor.vault.getTableID($("#" + id)));
}
});
此代码在我的网络浏览器上运行良好,但在移动设备上却不行,因为 OriginalTarget 返回 undefined。有没有办法在移动网络浏览器上获取原始目标?
【问题讨论】:
-
为什么要将 jquery 与 javascript 混合使用。给你的元素一些 id 和/或类绑定在它们上面
-
trb在哪里?$(trb).click(function(elem){你能解释一下这条线吗?
标签: javascript jquery html mobile