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 277935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:09:32+00:00 2026-05-12T01:09:32+00:00

This is a kind of a random thing I need. Basically my setup is

  • 0

This is a kind of a random thing I need. Basically my setup is something like this:

<div class="classname">
  <h3>
     <a class="anchor_classname" title="some_title">..</a>
  </h3>
</div>

The above html segment gets repeated on the page for all existing records.

What I need to do is this: using Jquery, I want to grab the tooltip text from the nested anchor (i.e. “some_title”) and set this text to the ‘title’ attribute of the containing div. I need this to be done for all records where each title text is unique. Is this possible with the setup I’ve shown or would I need some unique identifiers to distinguish between records? Could someone describe how to accomplish this with jquery? Thanks.

Update: using David’s suggestion I managed to use his code and change it slightly as follows:

    $('a.anchor_classname').each(function () {
      var title = $(this).attr("title"); //line 1
      var div = this.parentNode.parentNode; //line 2
      div.title = title; //line 3
    })

How can I convert line 2 and 3 to strictly use jquery functions like parent() and attr(). (It works as it is but I assume it would be better practice to use the standard jquery functions for compliance).

  • 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-05-12T01:09:32+00:00Added an answer on May 12, 2026 at 1:09 am

    Duplicating information in this way strikes me as something that is likely to be harmful to accessibility (or at least irritating to screen reader users), and providing effects better achieved by styling the link to fill the h3 and the h3 to fill the div.

    That said, this untested code will probably do the job:

    jQuery('div.classname > h3 > a.anchor_classname').each(function () {
      var title = this.title;
      var div = this.parentNode.parentNode;
      div.title = title;
    })
    

    Or the slower, less efficient, jQuery-where-native-DOM-would-do approach:

    jQuery('div.classname > h3 > a.anchor_classname').each(function () {
      var jq = jQuery(this);
      var title = jq.attr('title');
      var div = jq.parent().parent();
      div.attr('title', title);
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a coding problem for those that like this kind of thing. Let's see
I'm implementing a table with a fixed header using this kind of setup: <div
this kind of follows on from another question of mine. Basically, once I have
I would like to make a simple desktop application to learn this kind of
I already know there's answers for this kind of thing, but I don't really
I know questions of this kind have been asked before, but my situation differs
I have ask this kind of question before, but it seems my previous question
I have this kind of code in some applications (from microsoft) [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( Microsoft.Naming,
My stomach churns when I see this kind of output. http://www.freeimagehosting.net/uploads/e1097a5a10.jpg and this was
I have a file that contains this kind of paths: C:\bad\foo.c C:\good\foo.c C:\good\bar\foo.c C:\good\bar\[variable

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.