The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Remove mouse highlighting ability on a page?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #31059

    You know when you click your mouse and drag, it highlights texts and elements on the page and such? Is there a way to remove that function?

    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;

    Gecko and Webkit are the only ones supporting it atm though.


    You could put an invisible div ontop of the text. Assuming this doesn’t have to be done in dynamic places.

    Edit: Also, I came across this javascript example:

    $.fn.disableSelection = function() {
    $(this).attr('unselectable', 'on')
    .css('-moz-user-select', 'none')
    .each(function() {
    this.onselectstart = function() { return false; };

    Be careful with this, I have been to a few sites with Javascript used to disable selection, or right click.

    When I’m reading a page I often highlight sections so I can see where I am in the text. I get rather annoyed when the browser doesn’t do what I expect. This includes Highlighting;

    Remember that if people want to copy your text, they will find a way.


    No, that wont be an issue in this case. I have a built in slider to scale an image and when they move the slider, its highlighting stuff on the page.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.