Reputation: 1047
I have made a jQuery mobile widget which has a minus button on the left and a plus button on the right and a div in the middle with a number which gets updated after either the plus or minus buttons is pushed. It's essentially just a "quantity" selector.
The problem is that when either button is pressed too frequently (if you wanted to add a couple of items quickly) then it selects other text on the page, as in the screenshot.
Can anyone think of a way of preventing this?
Upvotes: 2
Views: 497
Reputation: 839
You have to prevent text selection in your buttons :
Here is a cross-compatible CSS class
.noselect {
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
And add this class to all your element you want to not be selectable.
Upvotes: 2
Reputation: 1980
It seems what you are looking for is user-select
For more information you can also check this answer: How to disable text selection highlighting using CSS?
Upvotes: 1