View Full Version : [Request] HTML code for disable some selection text but remain some selection area?
didla08
01-27-2015, 12:41 PM
I see some website can disable selection text on some body post. But remain some text that can still be selected. Like writing post can not be selected for protecting that content, but html code can be selected for share.
How they can to do that?
Thanks.
didla08
Beverleyh
01-27-2015, 12:44 PM
Please provide an example website that exhibits this behaviour.
didla08
01-27-2015, 03:32 PM
Actually i found 3 blogs can do that. But i just remember 1. here: http://helplogger.blogspot.com/2012/05/recent-posts-widget-with-thumbnails-for.html
Their text can not be copied but the html code can be copied. I search in google but i don't get the right answer. Maybe you can help me out sir.
FrickenTrevor
01-28-2015, 04:12 AM
Try this JavaScript
<script>
if (typeof document.onselectstart!="undefined") {
document.onselectstart=new Function ("return false");
}
else{
document.onmousedown=new Function ("return false");
document.onmouseup=new Function ("return true");
}
</script>
Or with CSS, however it may not work on some browsers. Use JavaScript for more availability.
.un-select-able {
-webkit-user-select: none; /* Chrome all / Safari all */
-moz-user-select: none; /* Firefox all */
-ms-user-select: none; /* IE 10+ */
/* No support for these yet, use at own risk */
-o-user-select: none;
user-select: none;
}
didla08
01-31-2015, 02:43 PM
Thank you sir for your help.
i've tried and it is working. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.