Tag Archives: Unselectable

Making text unselectable in browser

Long time back, I was working in a project which required us to make a particular position of text unselectable by the user on a webpage.

I was looking at various JavaScript solutions and finally found the CSS selectable property. But it was not working across different browsers. It took a considerable effort to make it work across different browsers.

I found this code while browsing through archives and thought of posting it here so that I know where to find it, if I need it and also it would be useful for others who want to do the same thing.

BTW, one quick disclaimer. Even I hate it when people make a particular position of text unselectable in a browser. So use it if it is really needed and also remember it is not fool-proof.

Well, let’s see the code then.

Posted in Web Programming | Tagged , | 3 Comments