1

I want to add code like <a><div></div></a> to make the whole block as a link, but after saving it getting changed to <div><a></a></div>. I am using CKeditor module, have done changes in config/text-format/filter HTML to disable the Limit allowed HTML tag. In short I want that editor do not do anything with HTML code.

2

I know that this is not the answer to your problem (which is annoying) but personally I would avoid putting a <div> inside a <a> tag. It is normally not allowed to put a "block" type of tag inside an "inline" type of tag.

So you could do the following:

<a class="block"><span>Your stuff</span></a>

and then add a CSS rule:

a.block,
a.block > span {
  display: block;
}

This way you are HTML valid and CKEditor should not try to correct it.

  • Actually i ended up to this stage, in search of finding how to make a enrite drupal block clickable. I want to make some block on the front page and entire block has to be clickable, i did not find that solution, I i thought to make 4 seprate <div></div> in body and cover that <div> using <a></a> so entire block gets clickable. But the issue is that, CKeditor is not allowing and in plain drupal body(without CKeditor) also it is not giving the output which we get while making the plain html doc and open in browser. – CodeNext Dec 4 '15 at 10:48
  • I tried your code also but it is converting to ` <p><a class="block"><span>Your stuff</span></a></p> ` – CodeNext Dec 4 '15 at 11:00
  • Well, it seems that you are trying to create some HTML code which is perhaps not the kind of text that an ordinary user would insert into a node body or a static block. I would create a module and implement the block hook if you need to do something very custom. Wysiwyg editors are mainly for simple text input. If not, isn't it possible to create a new input format (kind of full HTML) and affect no Wysiwyg editor to this format? – Patrick Janser Dec 4 '15 at 15:05
  • Yes, might be if i give the real world example, I want to make a block like any Adsense, when you hover the cursor over that block it shows the pointer and when you click it it direct to the url. Will make the new text format and will try. – CodeNext Dec 4 '15 at 15:31
  • 1
    Having the link inside a paragraph is not a problem. I made this quick codepen example to show you: codepen.io/patacra/pen/WrNjwz – Patrick Janser Dec 4 '15 at 15:44
1

go to:

/admin/config/content/ckeditor/edit/Advanced (for Filter HTML)

/admin/config/content/ckeditor/edit/Full (for Full HTML)

Then under Advanced Content Filter, select disabled.

enter image description here

If the above does not do it, depending on which one you are using (filter or full html) You need to go to

/admin/config/content/formats/filtered_html

OR

/admin/config/content/formats/full_html

Uncheck the correct faulty and chopped off html box.

enter image description here

  • Hi, I did both of things, but issue is the same. Even also tried the to disable the Limit allowed HTML tags, but no help, I am using filtered one. Thank though for answer. – CodeNext Dec 4 '15 at 9:23
  • WOW, looks like it's not possible, I've tried everything that I could think of. CKEditor keeps auto converting it to <div><a></a></div> ridiculous. – No Sssweat Dec 4 '15 at 9:43
  • Ya, it looks like.. – CodeNext Dec 4 '15 at 9:52

protected by Community Jul 24 '17 at 11:08

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.