I would like to add text to my webpage as a label and make it unselectable.
In other words, When the mouse cursor is over the text I would like it to not turn into a text selecting cursor at all.
A good example of what I’m trying to achieve is the buttons on this website (Questions,Tags,Users,…)
You can’t do this with plain vanilla HTML, so JSF can’t do much for you here as well.
If you’re targeting decent browsers only, then just make use of CSS3:
If you’d like to cover older browsers as well, then consider this JavaScript fallback:
If you’re already using jQuery, then here’s another example which adds a new function
disableSelection()to jQuery so that you can use it anywhere in your jQuery code: