Answers.Body: <p>If all your tables should use the same class or classes, you could use my <a href="https://github.com/mmikkel/RetconHTML-Craft" rel="nofollow">Retcon</a> plugin to add the classname(s) in Twig:</p>
  
  <pre><code>{{ entry.body|retconAttr('table', {class: 'someclassname'}) }}
  </code></pre>
  
  <p>If different tables need different classes, this isn't a solution, though.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-17T19:34:01.883Z
Answers.LastActivityDate: 2016-10-17T22:12:00.317Z
Answers.LastEditDate: 2016-10-17T22:12:00.317Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I have a site (Craft 2.5.2754) and am trying to add a class to a table within Redactor. Even if I disable Clean up HTML and Purify HTML (which would rather not do) the style is getting stripped out on save.</p>
  
  <p>I've had a look through the config/settings for Redactor and there is an 'allowedAttr' setting for earlier versions but seems to have been removed in Redactor II.</p>
  
  <p>Any suggestions on stopping the class being stripped out, preferably without having to disable Clean up HTML and/or Purify HTML?</p>
  
Tags: <redactor><settings><table><classes>
Title: Redactor settings: stripping out classes from table
ThreadText: # Redactor settings: stripping out classes from table
  
  (Asked by: username_0 on 2016-10-17)
  
  I have a site (Craft 2.5.2754) and am trying to add a class to a table within Redactor. Even if I disable Clean up HTML and Purify HTML (which would rather not do) the style is getting stripped out on save.
  
  I've had a look through the config/settings for Redactor and there is an 'allowedAttr' setting for earlier versions but seems to have been removed in Redactor II.
  
  Any suggestions on stopping the class being stripped out, preferably without having to disable Clean up HTML and/or Purify HTML?
  
  **Tags:** redactor, settings, table, classes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-10-17. Score: 3
  
  If all your tables should use the same class or classes, you could use my [Retcon](https://github.com/mmikkel/RetconHTML-Craft) plugin to add the classname(s) in Twig:
  
  ```
  {{ entry.body|retconAttr('table', {class: 'someclassname'}) }}
  
  ```
  
  If different tables need different classes, this isn't a solution, though.
  
  
  ---
  
  