Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8529665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:04:57+00:00 2026-06-11T09:04:57+00:00

I am using some Javascript to swap text from a title tag to a

  • 0

I am using some Javascript to swap text from a “title” tag to a description below the large image on my page.

How can I add a link to the text that is being swapped below the large image?

Sample page here – Sample Page

js –

    function updateCaption(elm) {
    document.getElementById('captionText').innerHTML = elm.getAttribute('title');
}

html –

<a href="ipod-blue-large.jpg" onmouseover="updateCaption(this);" title="iPod Blue" rel="zoom-id:ipod" 

<a href="ipod-blue-large.jpg" class="MagicZoom"  id="ipod"><img src="ipod-blue-large.jpg"></a><span id="captionText">Text to be swapped</span>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:04:58+00:00Added an answer on June 11, 2026 at 9:04 am

    As the name implies, innerHTML accepts standard HTML. So you may do this :

    function updateCaption(elm) {
         document.getElementById('captionText').innerHTML = "<a href=somehref>"+elm.getAttribute('title')+"</a>";
    }   
    

    Supposing you’d want to have the same href for the caption than for the image, you may do this :

    function updateCaption(elm) {
         document.getElementById('captionText').innerHTML = 
              '<a href="'+elm.href+'">'
              + elm.getAttribute('title')
              + '</a>';
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using some javascript to scroll some text on my web page.
I'm using some JavaScript from http://snippets.dzone.com/posts/show/4973 , and the scrollTop suggestion below it, to
I am trying to read text from a textarea in IE8 using some JavaScript,
I have been using some Javascript to create a text field once an certain
I am using some pre-written JavaScript from polldaddy. They have a JavaScript option which,
I'm using some Javascript I found from a post on StackOverflow. When I start
I am using some JavaScript to change the title of an element. However, I
I'm using jqZoom to swap a main image from selected thumbnail images, but I
I'm playing around with using some javascript to add extra functionality to a back
I have an asp.net web page written in C#. Using some javascript I popup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.