Display image alt text within a div on page

1.8k views Asked by At

I have an image displaying as a background on my page through a plugin, and I'm trying to display the ALT text from that image within a DIV elsewhere on the page.

Here's the code that's coming up:

<!-- 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 -->

Can someone suggest javascript, or something else, that would allow me to output that "Caption Text" within the following DIV?

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

Any help is hugely appreciated.

2

There are 2 answers

3
Rory McCrossan On

Try this:

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

try this:

$(".inner-quote").html($("#myatu_bgm_top").attr("alt"));