gpt4 book ai didi

javascript - 如果标题已经不存在,如何添加和重复与 alt ="some text"相同的标题 ="some text"?

转载 作者:行者123 更新时间:2023-11-30 13:41:03 25 4
gpt4 key购买 nike

如果标题不存在,我想添加并重复 title="some text"与 alt="some text"相同。在 FF 中也显示 Alt 文本。

之前

alt="some text"

alt="some text" title="some another text"

之后

alt="some text" title="some text"

alt="some text" title="some another text"

**我需要*

jquery(无冲突)

  • 或简单的 javascript 代码。**

最佳答案

作为旁注:

The contents of an ALT attribute should not be a tooltip (even though IE displays it like this, which it shouldn’t). The text should be short (less than 100 words, as per WCAG 2.0). The text should also be relevant to the primary content so users may use it INSTEAD of the image and still gain the image’s value. In this case, it’s an accessibility thing rather than a usability thing.

Source: Proper Use Of ALT And TITLE Attributes

另一方面,title 属性旨在提供有关元素的附加信息。

关于javascript - 如果标题已经不存在,如何添加和重复与 alt ="some text"相同的标题 ="some text"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2250743/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com