Štěpán Heller Štěpán Heller - 1 month ago 5
HTML Question

How to change <a> to <div>?

I'm stuck with the following issue. On my page I need to remove the hyperlinks from portfolio elements (see image below).

portfolio elemente

The website is in Wordpress with Semplice template so I cannot go directly to the code but I'm stuck with jQuery. I tried to remove the

href
attribute from the
<a>
tag but no luck. The solution is probably in replacing the
<a>
tag with
<div>
but I wasn't able to do it. Can you please help me?

Answer

In your special case I will use jquery off,

In your code you should call it like this to match the way your website is using jquery:

jQuery(function($){$('a').off();})

This will disable all events on all anchors, I think you will need to edit the selector with something like '.thumb a' to disable just anchors you want not everything on the page.

With this solution, no need to replace any elements which will cause I lot of styling issues.