1

I have the following:

  <span style="float:left; padding-right: 5px;">
    <span class="noselect" style="display:block;">Harvard</span>
    <span>John Smith</span>
  </span>

  <span style="float:left; padding-right: 5px;">
    <span class="noselect" style="display:block;">Chicago</span>
    <span>Tucker Max</span>
  </span>

  <span style="float:left; padding-right: 5px;">
    <span class="noselect" style="display:block;"></span>
    <span>Rihanna</span>
  </span>

  <span style="float:left; padding-right: 5px;">
    <span class="noselect" style="display:block;">NYU</span>
    <span>Peter Simpson</span>
  </span>

CSS:

.noselect{
-webkit-user-select: none !important;  /* Chrome 49+ */
user-select: none !important;          /* Likely future */
}

Now I disabled selectability for the spans with the universities. This works. However, when I select a user or even multiple users, and then copy paste this to somewhere else, the Universities are also being copied.

How can I disable this? I would like the user to not be able to copy the university names, but only the names of the users.This would also make sense, since only the users are selectable for the user anyways.

Other than HTML & CSS I am using React & electron, if this should be of any help. This is why I am only targeting chrome, and not ff or ie etc.

PS: The solution of this "possible duplicate" does not work for me. My text is not selectable, yet when I paste it, there is more text than I saw I had selected.

suman j
  • 6,710
  • 11
  • 58
  • 109
George Welder
  • 3,787
  • 11
  • 39
  • 75
  • how have you disabled selectability for the university spans? share the entirety of your code so we (i) can have a better idea of what is happening. – albert Jun 06 '17 at 22:09
  • I updated it. To be honest, although I have this included in my code / classes, I have the feeling that on this issue electron is also contributing its share here, but I am not sure how... – George Welder Jun 06 '17 at 22:20

0 Answers0