I'm trying to insert a clip <div class="my-class">my text</div>. But when I insert the clip, the DIV tags are removed.

I have this setting in my Redactor config json: replaceDivs: false

  • That is really cryptic question. Can you clarify? Commented Dec 17, 2014 at 4:10
  • I write in plugin <div class="my-class">my text</div>, but when I insert the clip div tags are cut enter code here Commented Dec 17, 2014 at 9:14

1 Answer 1



There's other problems / bugs with the Redactor API going on that lead to unexpected behavior on formatting the inserted HTML. The solution provided below does allow to insert HTML with DIV tags only if inserted in a new paragraph, otherwise it strips the tags. Another issue I came across is that I get empty SPAN tags added and I don't know where these come from?!


The plugin uses Redactor API's insert.html function. Which by default cleans the HTML before inserting it. But there's a parameter to prevent it from doing so.

You can hack / fork the plugin and set the parameter in redactorclips/resources/clips.js (line 63):

this.insert.html(html, false);

I will create a Github issue for this, because it definitely makes sense to have HTML cleaning disabled by default or at least have a setting for it. (Edit: makes no sense as long as there's all the other issues with the API!)

  • This still seems to be an issue with the clips plugin, as Redactor was insisting on stripping <br> tags in a clip that I created. The API seems to have changed slightly now - you need to change this.insert.html() to this.insert.raw() if you want the clip markup to be added unmolested.
    – Dom Stubbs
    Commented Jan 22, 2018 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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