1

I'm trying to disable the ability for a user to select the text that they put in to a textarea. There is a question similar to this but I've fiddled around on the jsfiddle and can't get it to work properly. I need it so that if a user tries to select user submitted text in a text area with either Ctrl+A or by the mouse, they can't, (without disabling the ability to type in the first place).

I tried the

    *.unselectable {
        -moz-user-select: -moz-none;
        -khtml-user-select: none;
        -webkit-user-select: none;
        -o-user-select: none;
        user-select: none;
    } 

CSS method but that doesn't seem to work at all. Really stuck on this, is it even possible?

Community
  • 1
  • 1
Jack Clarke
  • 159
  • 1
  • 10
  • 1
    I thinks it's a bad UI behaviour, what are you trying to achieve? Maybe there is another solution – Irvin Dominin Jan 22 '14 at 11:54
  • In any case, anyone with access to the browsers developer tools will be able to bypass any JS/CSS limitations... What exactly are you trying to accomplish? – Lix Jan 22 '14 at 11:54
  • do you want to disable copy-paste,select all? tell why u need this – Govind Singh Jan 22 '14 at 11:56
  • It's intentionally dysfunctional, I'm trying to recreate a typewriter but in an app. I've disabled backspace etc but there's still the issue of a user selecting all the text and then typing new characters that replace old ones... – Jack Clarke Jan 22 '14 at 11:56
  • @JackClarke - What about receiving input from the user character by character but displaying the content in an un-editable element - such as a `
    ` or ``?
    – Lix Jan 22 '14 at 12:01
  • 1
    @Lix that's a good shout, I'll give that a go thanks for the idea – Jack Clarke Jan 22 '14 at 12:34

0 Answers0