How to disable anchor tag using jQuery

How to disable anchor tag using jQuery? Disable anchor tag click event, so when user click on link default page redirect prevented and written process execute.

Solution to disable anchor tag using jQuery is e.preventDefault(). Write anchor tag click jQuery event and call preventDefault() function in event function.

jQuery
jQuery

Steps: How to disable anchor tag using jQuery

  • 1. Add id to your anchor tag: <a href=”vevlo.com” id=”linkId”>Link</a>
  • 2. Write click event: $(‘#linkId’).click(){}
  • 3. Prevent anchor tag default event: $(‘#linkId’).click(e){ e.preventDefault(); }
  • 4. Same process can be done using any jQuery Attribute selectors