0

I have the following html -:

<div contenteditable="true">Hey man <a class="ddt">Harry</a></div>

I would want that the user is not able to select the a.ddt element. In simple words, all other contents inside the div can be selected, but the a.ddt cannot be selected.

How do i do this... Thanks for help.

Pete
  • 57,112
  • 28
  • 117
  • 166
sanchitkhanna26
  • 2,143
  • 8
  • 28
  • 42
  • can you expand on what you mean by selected? do you mean that the user should not be able to click the link? Or the user should not be able to tab to the link? Or something else? – Pete Uh Apr 29 '13 at 13:00

3 Answers3

1

Disabling Selection in jQuery, Can be invoked through $('.button').disableSelection();

Alternately, using CSS (cross-browser):

.button {

    -moz-user-select: none; 
    -khtml-user-select: none; 
    -webkit-user-select: none; 
    -o-user-select: none;  }

original post by aleemb.

Community
  • 1
  • 1
Terning
  • 144
  • 2
  • 10
0

It is not possible to add such a limitation on the DOM.

Ben
  • 60,438
  • 111
  • 314
  • 488
0

Are you talking about diabling selection using mouse?

If yes, then you should see this

How to disable text selection using jQuery?

Community
  • 1
  • 1
U.P
  • 7,357
  • 7
  • 39
  • 61