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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:45:36+00:00 2026-06-11T23:45:36+00:00

I have a graph in SVG format, and I wanted to implement a functionality

  • 0

I have a graph in SVG format, and I wanted to implement a functionality that changes the title property of any node when the mouse pointer hovers over it, and back to the old title when the pointer moves away. To implement this, I’m trying to use the jQuery library and my code looks like this:

var oldTitle;
$(document).ready(function() {
    $("g[class=node]").hover(funciton() {
        oldTitle = $(this).prop("title");
        $(this).prop("title", "New Title!");
    }, function() {
        $(this).prop("title", oldTitle);
        }
    );
});

However, for some reason the code is not functioning and I cannot see the expected effect. Any ideas as to what is going wrong here?

EDIT: I think I have an idea of what the problem is, but am still looking for a solution to it. So, in the vector graphics html code, a node is represented as:

<g id="node2" class="node"><title>SomeTitle</title>
        <ellipse fill="forestgreen" stroke="forestgreen" cx="243.017" cy="-678" rx="27" ry="18"/>
        <text text-anchor="middle" x="243.017" y="-674.3" font-family="Times New Roman,serif" font-size="14.00">b</text>
</g>

Now, I want the hover action to change the text between <title> ... </title> and change it back when the mouse pointer moves away.

Any help on how this can be acheived?

PS: $(this).prop(“title”) returns undefined, so title out here is not a property of the node element…. then, what is it? And how can it be changed?

Thanks a lot!

  • 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-11T23:45:37+00:00Added an answer on June 11, 2026 at 11:45 pm

    this may work

    var oldTitle;
        $(document).ready(function() {
            $("g[class=node]").hover(function() {
                oldTitle = $(this).attr("title");
                $(this).attr("title", "New Title!");
            }, function() {
                $(this).attr("title", oldTitle);
                }
            );
        });
    

    This code will work In the case that when you have something like that

     <g id="node2" class="node" title="SomeTitle" >
                <ellipse fill="forestgreen" stroke="forestgreen" cx="243.017" cy="-678" rx="27" ry="18"/>
                <text text-anchor="middle" x="243.017" y="-674.3" font-family="Times New Roman,serif" font-size="14.00">b</text>
        </g>
    

    But you are using <title></title>
    than use

    var oldTitle;
            $(document).ready(function() {
                $("g[class=node]").hover(function() {
                    oldTitle = $(this).find("title").text();
                    $(this).find("title").html("New Title!");
                }, function() {
                    $(this).find("title").html(oldTitle);
                    }
                );
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that generates a data-driven SVG graph and I'd like to display
I need to have a linked text inside a svg graph. Here is what
I have a graph that contains nodes (groups) composed by inner nodes and when
I have a graph (organigram) how this: digraph G { nodesep=0.3; ranksep=0.2; margin=0.1; node
I have a simplr svg-graph and I'm trying to create a simple tooltip-popup for
I have a d3.js graph that is made up of rects, and I'd like
I have made a very simple Pie Graph generator using Javascript & SVG graphics.
Need help. I have Graph API code that uses an auth token with offline
We have social graph that is later broken to clusters of high cohesion. Something
I have a div element which contains a svg graph (bunch of circles and

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.