/    Sign up×
Community /Pin to ProfileBookmark

Update a <P> from another tag when hovering over it

Hi, Can anyone help as I am new to javascript. I have the following tag layout on a page and i want to update a <p> tag with data from another <p> tag nested inside an <anchor> tag. This nesting is continous for each image load onto my page. I would like to hover over each image and it automatically updates the <p< tag with the relevant text from the nested <p> tag. The images are added to the page dynamically so i dont know how many will be loaded.

<div id’products’>
<a><img src=’myimg1.jpg’><p>Some data here</p></a>
<a><img src=’myimg2.jpg’><p>Some data here</p></a>
<a><img src=’myimg3.jpg’><p>Some data here</p></a>
<a><img src=’myimg4.jpg’><p>Some data here</p></a>
etc……..
</div>
<p>This tag is the one i want filled with the data from above P tag when i hover over each image</p>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@TheGoonerboyauthorJul 08.2009 — thanks for that.
×

Success!

Help @TheGoonerboy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...