bodley
bodley

Reputation: 187

Disable href in inner element of div

I have a question. How can i disable href from inner element of div when href is placed in the parent element? Maybe I try to visualize it:

<span class='img' href="someLink">
  <div class="main">
    <h2 contenteditable="true">Some txt</h2>
  </div>
</span>

I want to disable href function from <h2> (because I want to edit it by clicking on them, now as you know I am redirecting to href url), and left it in other html elements. How can i do that? Is there any option to do it using only html tag(s)? Or the only one option is to use js / jQuery? Can u give me an example or solution?

Upvotes: 0

Views: 1111

Answers (1)

R3tep
R3tep

Reputation: 12864

You can do it like this :

<h2 contenteditable="true" onclick='return false;'>Some txt</h2>

Upvotes: 1

Related Questions