Search code examples
javascriptjquerycsswordpresshref

Disable HREF within P element


I'm using wordpress 4.8 and plugin WPDISCUZ for commenting system. How do I disable ONLY this HREF within this plugin from functioning (become regular span) while other href still work normally? I mean I don't want my reader to click this link accidentally or intentionally and sent to admin login page but instead they can login via their social network on comment fields. Is there any way to fix this using Javascript/jQuery?

Image: Screenshot

CSS from view source.

<p class="wc-must-login">You must be <a rel="nofollow" href="https://www.example.com/admin-login-page/">logged in</a> to post a comment. </p>

NOTE:

  1. This CSS is from plugin. I cannot add/remove class to it.
  2. I don't want to change CSS class wc-must-login to display:none. Reason: Reader need to know they have to login to leave a comment.

EDIT: I thought only Javascript / jQuery can achieve this while CSS only for styling. But thanks to Farhad Bagherlo seems it can be achieve with similar effect using CSS.


Solution

  • .wc-must-login a {
       pointer-events: none;
       cursor: default;
    }
    <p class="wc-must-login"><a target="_blank" href="https://us.yahoo.com/">link</a></p>