In Chrome v.25 I use this code to avoid text cursor while dragging HTML element:
document.addEventListener("mousemove",function(e) { e.returnValue = false; });
Every <input type="number"/>
is crippled (see jsfiddle )
I already managed to avoid this by setting the false returnValue only while dragging. But what exactly happens here? Is it a bug or some feature?
You can achieve this with CSS, if I understand what you mean correctly...
.no-select {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
Just add that to the elements that you don't want to be selectable.
This does look like rather a string issue, as I wouldn't call pressing up on a number input a mousemove event, but in any case, the issue exists. The CSS may be a more elegant solution.
Check the fiddle here:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.