admin管理员组文章数量:1278918
I have a table on my web page that have checkboxes on them. I have jquery code that allows me to shift click to check multiple rows for editing/removal. But when I shift click to select a range all of the text inside the range gets highlighted.
Is there any way using jquery or css to stop the text from being highlighted?
--EDIT--
HTML code
...
<tbody>
<tr>
<td>
<input type="checkbox">
</td>
<td>
<div class="cam_ip">192.168.200.78</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox">
</td>
<td>
<div class="cam_ip">192.168.200.250</div>
</td>
</tr>
</tbody>
There can be x amount of rows.
The jquery works when I click a row, that row is marked as an anchor, then when I shift click on another row it is marked as anchorrange, then a function is called which will loop through each row inside the range making it checked.
The side effect of using e.shiftClick();
is that all the text within the range gets highlighted. I need to stop this side effect.
I have a table on my web page that have checkboxes on them. I have jquery code that allows me to shift click to check multiple rows for editing/removal. But when I shift click to select a range all of the text inside the range gets highlighted.
Is there any way using jquery or css to stop the text from being highlighted?
--EDIT--
HTML code
...
<tbody>
<tr>
<td>
<input type="checkbox">
</td>
<td>
<div class="cam_ip">192.168.200.78</div>
</td>
</tr>
<tr>
<td>
<input type="checkbox">
</td>
<td>
<div class="cam_ip">192.168.200.250</div>
</td>
</tr>
</tbody>
There can be x amount of rows.
The jquery works when I click a row, that row is marked as an anchor, then when I shift click on another row it is marked as anchorrange, then a function is called which will loop through each row inside the range making it checked.
The side effect of using e.shiftClick();
is that all the text within the range gets highlighted. I need to stop this side effect.
- 1 You gotta show us your code + which plugin you use. – gdoron Commented Apr 20, 2012 at 13:52
1 Answer
Reset to default 10CSS version
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
also a possible related question to How to disable text selection highlighting using CSS?
Year later edit (integrating from ment):
Colleague pointed this out Is there a way to make text unselectable on an HTML page? - use unselectable="on"
on whatever you want not selectable
本文标签: javascriptStop a shift click from highlighting textStack Overflow
版权声明:本文标题:javascript - Stop a shift click from highlighting text - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741288252a2370399.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论