SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru mdumka's Avatar
    Join Date
    Jul 2003
    Location
    True North
    Posts
    642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I add a title to an <A> tage using Javascript?

    Hello,

    I am trying to add a title to a <A> tag using JavaScript.

    I can add a class using this method ...

    Code:
    document.links[i].className = "myClass";
    But title does not seem to be working ...

    Code:
    document.links[i].title = "myTitle";
    Am I doing something wrong?

    Thanks

    Mike

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,045
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    I don't see why if an attribute wasn't already existing it would create and add one for class but not title, but maybe if you do a createAttribute? eg.
    HTML Code:
    d = document.getElementById("div1);
     
    p = d.createAttribute("proportion");
     
    p.value = "100";
    https://developer.mozilla.org/en/DOM...reateAttribute


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •