2

So, I have links that are automatically generated.

For a specific page I don't want users to click the link (only see that it is there).

Without modifying the code, I am thinking of putting a div container over it with high z-index so that users cannot click it.

Should I embed a 1 pixel image with background repeat that are positioned exactly on top of the link or is there a better way of achieving this?

Thanks

Steve Kim
  • 5,293
  • 16
  • 54
  • 99
  • Could you not just intercept the click with JS? Also, how are you going to create an absolutely positioned `div` element without modifying the code? – BenM Apr 23 '15 at 07:26

1 Answers1

1

You can disable pointer events using CSS, actually. For example, if you add a class or can identify the <a> element in some way, you could use this CSS:

a.disabled {
   pointer-events: none;
   cursor: default;
}

Browse support for pointer-events can be seen here.

Credit to this StackOverflow answer.

Community
  • 1
  • 1
BenM
  • 52,573
  • 26
  • 113
  • 168