ionic 2: How to make text selectable?

You need to add the following CSS to the HTML tag you want to be selectable

user-select: text;

For my Ionic 4 project, using the body tag didn't work but this did:

* {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

In Ionic 4 add

* {

    -webkit-user-select: text;
    
    -moz-user-select: text;
    
    -ms-user-select: text;
    
    user-select: text;
    
    }

**to the global.scss file. ** But if you want to copy/paste only a specific tag text, add something like this instead in your global.scss:

.selectable {

    -webkit-user-select: text;
    
    -moz-user-select: text;
    
    -ms-user-select: text;
    
    user-select: text;
    
    }

And then add class="selectable" property to the tag.

Hope it helps


I added

body {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}

to the app.scss file

For individual items, since this is SCSS, you can also create a mix-in with those 4 css lines. Keep in mind Safari or other browsers may not respond well to just user-select.