# Default alt tag for all images with blank alt tag?

**URL:** <https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390>\
**Category:** RapidWeaver Classic\
**Created:** [April 17, 2020, 6:24am UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390 "2020-04-17T06:24:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![devananda](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/devananda/32/13413_2.png) [@devananda](https://forums.realmacsoftware.com/u/devananda)\
**Post date:** [April 17, 2020, 6:24am UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/1 "2020-04-17T06:24:02Z")

</div>

I am using a stack that allows the user to add an image but does not have an option for an alt tag.

Anyone have any `code to share` where I can add a default alt tag to an image if the alt tag is empty?

I wanted to edit the original post to put a link: [https://xrdi.com/about/timeline/](https://xrdi.com/about/timeline/)

---

<div class="post-metadata">

**Author:** ![Rovertek](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/rovertek/32/223_2.png) [@Rovertek](https://forums.realmacsoftware.com/u/Rovertek)\
**Post date:** [April 17, 2020, 1:07pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/2 "2020-04-17T13:07:11Z")

</div>

Wouldn’t it be easier and more sensible to use a better image stack?

---

<div class="post-metadata">

**Author:** ![DLH](https://avatars.discourse-cdn.com/v4/letter/d/b5e925/32.png) [@DLH](https://forums.realmacsoftware.com/u/DLH)\
**Post date:** [April 17, 2020, 1:17pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/3 "2020-04-17T13:17:30Z")

</div>

Which image stack are you using? If you’re using the one that comes with Stacks, then you need to double-click the image after it’s dropped on the stack to see additional options, including Alt Text.

---

<div class="post-metadata">

**Author:** ![teefers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teefers/32/8173_2.png) [@teefers](https://forums.realmacsoftware.com/u/teefers)\
**Post date:** [April 17, 2020, 1:41pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/4 "2020-04-17T13:41:49Z")

</div>

> [@devananda](#):
>
> add a default alt tag to an image if the alt tag is empty?

That would probably defeat the purpose of the `alt attribute`.

> The required alt attribute specifies an alternate text for an image, if the image cannot be displayed.

> The alt attribute provides alternative information for an image if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).

I’m not sure how you can have a default tag that could describe every possible image.

Images that convey no information, but are purely decorative, can use an empty `alt=""` tag. That makes the page navigable for users of screen readers or non-graphical browsers.

---

<div class="post-metadata">

**Author:** ![devananda](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/devananda/32/13413_2.png) [@devananda](https://forums.realmacsoftware.com/u/devananda)\
**Post date:** [April 17, 2020, 6:26pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/5 "2020-04-17T18:26:15Z")

</div>

Alhoa @DLH I am using 1LD feature section/ feature card stack. When I double click there is no option to edit like in native image stack.

I am going to try putting JavaScript that takes an empty `alt` attribute and adds text.

---

<div class="post-metadata">

**Author:** ![devananda](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/devananda/32/13413_2.png) [@devananda](https://forums.realmacsoftware.com/u/devananda)\
**Post date:** [April 17, 2020, 6:26pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/6 "2020-04-17T18:26:32Z")

</div>

agreed @Rovertek!

---

<div class="post-metadata">

**Author:** ![DLH](https://avatars.discourse-cdn.com/v4/letter/d/b5e925/32.png) [@DLH](https://forums.realmacsoftware.com/u/DLH)\
**Post date:** [April 17, 2020, 7:18pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/7 "2020-04-17T19:18:52Z")

</div>

It looks like the 1LD Feature Section stack only has an option for a background image and not a regular image. There is a difference in how images are used. Background images are applied with CSS and therefore do not have `alt` tags.

---

<div class="post-metadata">

**Author:** ![devananda](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/devananda/32/13413_2.png) [@devananda](https://forums.realmacsoftware.com/u/devananda)\
**Post date:** [April 17, 2020, 7:30pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/8 "2020-04-17T19:30:54Z")

</div>

the option to add an image is there so it does not indicate that this is a background image.

the option to add an image is there but the option to add an alt attribute is not there. And when I look at the source code I see that there is and `img`` attribute but no `alt``` tag.

---

<div class="post-metadata">

**Author:** ![DLH](https://avatars.discourse-cdn.com/v4/letter/d/b5e925/32.png) [@DLH](https://forums.realmacsoftware.com/u/DLH)\
**Post date:** [April 17, 2020, 7:58pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/9 "2020-04-17T19:58:10Z")

</div>

I don’t have the stack and was going by the setting shown here: [https://www.onelittledesigner.com/rapidweaver-stack/feature-section/tutorial/](https://www.onelittledesigner.com/rapidweaver-stack/feature-section/tutorial/)

The only place I see an image is for card background. If there is a place for real images (not backgrounds), then I’d just ask if they can add an `alt` tag option.

---

<div class="post-metadata">

**Author:** ![devananda](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/devananda/32/13413_2.png) [@devananda](https://forums.realmacsoftware.com/u/devananda)\
**Post date:** [April 17, 2020, 9:26pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/10 "2020-04-17T21:26:02Z")

</div>

I am trying to use JavaScript to create and insert an `alt` attribute to the image. This is what I have so far but it is not working. Any suggestions:

```auto
$(document).ready(function() {

$(".feature-card > img").each(function() {
    $(this).attr("alt", "create and insert my new alt tag here");
    });

});</script>

```

this fines each `img` tag in the `feature-card` class and adds `alt` attribute. But it is not working as expected.

---

<div class="post-metadata">

**Author:** ![teefers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teefers/32/8173_2.png) [@teefers](https://forums.realmacsoftware.com/u/teefers)\
**Post date:** [April 17, 2020, 10:12pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/11 "2020-04-17T22:12:54Z")

</div>

> [@devananda](#):
>
> But it is not working as expected.

What’s not working? I don’t have the stack, but it should work, I just copied it, added an open `<script>` tag put it in an HTML stack and added an img stack with a class of `feature-card` and it added the alt tag.

Do you have a URL?

---

<div class="post-metadata">

**Author:** ![devananda](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/devananda/32/13413_2.png) [@devananda](https://forums.realmacsoftware.com/u/devananda)\
**Post date:** [April 17, 2020, 10:33pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/12 "2020-04-17T22:33:50Z")

</div>

The jquery is not adding an alt attribute to the img tag. It’s working for you? That’s great!

The url is: [https://xrdi.com/about/timeline/](https://xrdi.com/about/timeline/)

---

<div class="post-metadata">

**Author:** ![teefers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teefers/32/8173_2.png) [@teefers](https://forums.realmacsoftware.com/u/teefers)\
**Post date:** [April 17, 2020, 10:54pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/13 "2020-04-17T22:54:30Z")

</div>

> [@devananda](#):
>
> feature-card

I don’t see where you added the jquery code above?

How did you add it?

I put it in an html stack (you left off the openning `<script>` tag above.

---

<div class="post-metadata">

**Author:** ![willwood](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@willwood](https://forums.realmacsoftware.com/u/willwood)\
**Post date:** [April 18, 2020, 8:49am UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/14 "2020-04-18T08:49:30Z")

</div>

Can I be so bold and ask what you are trying to accomplish by adding ALT attributes and content client-side with Javascript?

These ALT attributes will not be seen by search engines indexing your website. And I imagine they’d be of very limited use to screen readers and other assistive tools. Ideally ALT attributes need to be hard-coded into the page.

As mentioned already, images that are provided purely for webpage cosmetics (like background wallpapers) do not require ALT attributes. You either leave the ALT attribute empty on an image or you set the image as a CSS background.

It’s only the images that form an integral part of your content (like images used to show products or promote services) that require the ALT attribute. Because in these situations, it is necessary to _describe what the image is about_; for the benefit of search engines, screen readers and other tools.

More info: [https://html.com/attributes/img-alt/](https://html.com/attributes/img-alt/)

I don’t own the aforementioned card stack and cannot see a free demo for it. But I imagine if there is no ALT field in the settings, it was not intended to be used for content-critical images - only images to be used for decoration.

---

<div class="post-metadata">

**Author:** ![peterdanckwerts](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/peterdanckwerts/32/22443_2.png) [@peterdanckwerts](https://forums.realmacsoftware.com/u/peterdanckwerts)\
**Post date:** [April 18, 2020, 9:15am UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/15 "2020-04-18T09:15:18Z")

</div>

I try to give all images, even ones which are used as background images, informative names. I don’t know if that helps with SEO when there is no ALT attribute, but it can’t do any harm and it makes images easier to identify.

---

<div class="post-metadata">

**Author:** ![devananda](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/devananda/32/13413_2.png) [@devananda](https://forums.realmacsoftware.com/u/devananda)\
**Post date:** [May 1, 2020, 7:05am UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/16 "2020-05-01T07:05:24Z")

</div>

thanks for all the replies! The developer was kind enough to send me an updated version with the option to add an alt tag.

@willwood makes sense! Bots will not see the alt tag because JavaScript would render it on the client side.

---

<div class="post-metadata">

**Author:** ![instacks](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/instacks/32/23339_2.png) [@instacks](https://forums.realmacsoftware.com/u/instacks)\
**Post date:** [May 1, 2020, 7:25am UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/17 "2020-05-01T07:25:41Z")

</div>

> [@willwood](#):
>
> These ALT attributes will not be seen by search engines indexing your website.

> [@devananda](#):
>
> Bots will not see the alt tag because JavaScript would render it on the client side.

Sorry folks to remind you Google’s indexing mechanism is executing JavaScript since some time now already.

---

<div class="post-metadata">

**Author:** ![willwood](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@willwood](https://forums.realmacsoftware.com/u/willwood)\
**Post date:** [May 1, 2020, 9:11am UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/18 "2020-05-01T09:11:57Z")

</div>

@instacks I am talking about _search engines_ in the collective sense - grouping together Google, Bing, Yahoo, Baidu, DuckDuckGo, Yandex and all the others out there.

A lot of these do not support Javascript. They might be less aggressive with their spidering or use older indexing algorithms. Same with all the search stacks for RapidWeaver.

The consensus amongst many experts is not to rely on Javascript to dynamically insert content into webpages - IF you need it seen by all search engines or available for assistive devices.

There are a lot of times when certain search engines will not see content being added with Javascript. Google is not the only search engine people use - especially with all the privacy concerns of late.

My advice to RapidWeaver users remains unchanged - ALT attributes for important images that need to be seen by search engines or broadcasted to assistive devices should have their ALT attributes hard-coded into the page. Then you are guaranteed everything and everyone will see them.

---

<div class="post-metadata">

**Author:** ![instacks](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/instacks/32/23339_2.png) [@instacks](https://forums.realmacsoftware.com/u/instacks)\
**Post date:** [May 1, 2020, 9:31am UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/19 "2020-05-01T09:31:07Z")

</div>

Sure. Other search engines will evolve too and include JavaScript also in the future. My 2 cent.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/system/32/25301_2.png) [@system](https://forums.realmacsoftware.com/u/system)\
**Post date:** [May 31, 2020, 7:31pm UTC](https://forums.realmacsoftware.com/t/default-alt-tag-for-all-images-with-blank-alt-tag/32390/20 "2020-05-31T19:31:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
