1

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?

enter image description here

Brad
  • 847
  • 1
  • 7
  • 20

2 Answers2

2

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.

ReaperSoon
  • 605
  • 5
  • 20
1

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?

Community
  • 1
  • 1
Neikos
  • 1,574
  • 1
  • 19
  • 32