jquery - 在页面上的 div 中显示图像替代文本

标签 jquery css image alt

我有一张图片通过插件显示为我页面上的背景,我试图在页面其他地方的 DIV 中显示该图片的 ALT 文本。

这是即将出现的代码:

<!-- Background Manager Start -->
<div id="myatu_bgm_img_group" class="myatu_bgm_fs" style="overflow: hidden;"><script type="text/javascript">
    /*<![CDATA[*/
        try{(function(a){myatu_bgm.addTopImage("",function(){if((typeof myatu_bgm!=="undefined")&&(myatu_bgm.initial_ease_in==="true")){a(this).fadeIn("slow")}else{a(this).show()}})}(jQuery))}catch(e){};
    /*]]>*/
    </script><noscript><img id="myatu_bgm_top" class="myatu_bgm_fs" src="http://mgrezova.webfactional.com/wp-content/uploads/2013/06/agnesbshirt.jpg" alt="Caption Text"   /></noscript></div>
<!-- Background Manager End -->

有人可以建议 javascript 或其他东西,让我可以在以下 DIV 中输出“标题文本”吗?

<DIV class="quote">
    <DIV class="inner-quote">
    </DIV>
</DIV>

非常感谢任何帮助。

最佳答案

试试这个:

$('.inner-quote').html($('#myatu_bgm_top').prop('alt'));

关于jquery - 在页面上的 div 中显示图像替代文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18696913/

相关文章:

jquery - 单击时更改图像 (svg)

java - 通过数组操作 BufferedImage 中的像素

javascript - CSS3 - 如何交叉淡化未知高度的图像并将它们垂直和水平居中

jquery - 时间选择器容器不包装其内容

html - 为什么在清除 float 后不应用最高 margin ?

Jquery DatePicker 颜色星期日红色

java - 将 JPanel 转换为 JScrollPane 中的图像

javascript - 在javascript中下载数据是否有数据大小限制

javascript - 在添加选项后选择出现问题

html - 从 Firefox 中的输入类型 ="range"中删除焦点轮廓