<p>The <a href="https://github.com/mmikkel/RetconHTML-Craft" rel="nofollow noreferrer">Retcon plugin</a> works great for DOM manipulation. You can override the attribute with a default value or remove it completely.</p>

<pre><code>{{ entry.body|retconAttr('img', {'alt': entry.title}) }}
</code></pre>



<pre><code>{{ entry.body|retconAttr('img', {'alt': false}) }}
</code></pre>

CC BY-SA 3.0
2016-12-21T23:07:42.653Z
Of course you've got the better answer. :)
Brad Bell
CC BY-SA 3.0
2016-12-21T22:50:31.097Z
2016-12-21T22:50:31.097Z
carlcs
<p>Assuming you've got the <code>"source"</code> plugin defined in your <code>craft/config/redactor/myconfig.json</code> Redactor config for that Rich Text field's settings, you can click on the "HTML" button and edit the alt tag manually to whatever you wish. </p>

CC BY-SA 3.0
2016-12-21T22:20:16.477Z
2016-12-21T22:20:16.477Z
Brad Bell
<p>When I add an image via a rich text (doing as port of a flexi layout approach) somehow an alt tag gets auto output, e.g:</p>

<p>alt="sketch2.jpg#asset:308</p>

<p>I wondered if there is a way to over ride or edit the HTML via the rich text field for the auto generated alt tag?</p>

CC BY-SA 3.0
2016-12-21T22:03:55.573Z
Just click the Rich Text field's HTML button and change it to whatever you want?
Brad Bell
CC BY-SA 3.0
2016-12-21T22:18:14.250Z
thats the one, thanks tried earlier I thought but must have mucked up good to go now
user2569
CC BY-SA 3.0
2016-12-21T22:19:02.883Z
Cool... I'll add that as an answer.
Brad Bell
<richtext>
Over ride auto-generated alt tag on image added via Rich Text field
# Over ride auto-generated alt tag on image added via Rich Text field

(Asked by: username_0 on 2016-12-21)

When I add an image via a rich text (doing as port of a flexi layout approach) somehow an alt tag gets auto output, e.g:

alt="sketch2.jpg#asset:308

I wondered if there is a way to over ride or edit the HTML via the rich text field for the auto generated alt tag?

**Tags:** richtext
> **Comments:**
> **username_1**: Just click the Rich Text field's HTML button and change it to whatever you want?  
> **username_0**: thats the one, thanks tried earlier I thought but must have mucked up good to go now  
> **username_1**: Cool... I'll add that as an answer.  

---

## 2 answers

### Answer by username_2 on 2016-12-21. Score: 2

The Retcon plugin works great for DOM manipulation. You can override the attribute with a default value or remove it completely.
{{ entry.body|retconAttr('img', {'alt': entry.title}) }}

{{ entry.body|retconAttr('img', {'alt': false}) }}

> **Comments:**
> **username_1**: Of course you've got the better answer. :)  

---

### Answer by username_1 on 2016-12-21. Score: 1

Assuming you've got the `"source"` plugin defined in your `craft/config/redactor/myconfig.json` Redactor config for that Rich Text field's settings, you can click on the "HTML" button and edit the alt tag manually to whatever you wish.


---

