【发布时间】:2016-06-14 20:08:12
【问题描述】:
我正在尝试使可点击的表格行与 jquery 可选择功能一起使用,但我遇到了困难。它适用于 li 元素,但是一旦我尝试使用表格,点击事件就会停止工作。拖动选择作品,但我真的需要能够点击。这是我的代码:
$(function() {
$("#selectable").selectable();
});
#feedback {
font-size: 1.4em;
}
#selectable .ui-selecting {
background: #FECA40;
}
#selectable .ui-selected {
background: #F39814;
color: white;
}
#selectable {
list-style-type: none;
margin: 0;
padding: 0;
width: 100%;
}
#selectable tr {
margin: 0px;
padding: 0.4em;
font-size: 1em;
height: 10px;
}
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<!-- <link rel="stylesheet" href="/resources/demos/style.css"> -->
<table id="selectable" style="width:100%">
<tr class="ui-widget-content">
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr class="ui-widget-content">
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
有谁知道如何在上面的示例中使用 click 或 ctrl + click ?
【问题讨论】:
标签: javascript jquery html