Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2005
    Location
    Northfield, MA
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting the Title from and HTML element

    I was just wondering (sorry this may be a dumb question, I've never really worked with JavaScript) if there is a way to get the title from an HTML element after I get the element by its ID. Thanks for the help.
    I'm not always the most helpful, but I'm trying :P

  2. #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Yup:

    Code:
    var objtitle=obj.getAttribute('title');
    Basscyst
    Helping to build a bigger box. - Adam Matthews

  3. #3
    New Coder
    Join Date
    Jul 2005
    Location
    Northfield, MA
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So if I do:

    Code:
    var objecttitle=document.getElementById('elementId').getAttribute('title');
    I will be able to get the title of the element with the id 'elementId'?
    Thanks
    I'm not always the most helpful, but I'm trying :P


 

Posting Permissions

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