dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: getting the value of an element

  1. #1
    Join Date
    Dec 2012
    Posts
    6

    getting the value of an element

    Hello everyone ,

    After sending the following javascript code

    document.getElementById('cStatus')

    I got

    <img alt="Open" height="16" src="/jira/images/icons/status_open.gif" title="Open - The issue is open and ready for the assignee to start work on it." width="16">

    how can i have the value that is inside title , i mean:

    Open - The issue is open and ready for the assignee to start work on it.

    Thanks for your help.

  2. #2
    Join Date
    Dec 2012
    Posts
    1
    alert(document.getElementById('cStatus').getAttribute("title"))

  3. #3
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    500
    First give your image an id. Let assume it's cStatus. The HTML would be:
    <img alt="Open" height="16" src="/jira/images/icons/status_open.gif" title="Open - The issue is open and ready for the assignee to start work on it." width="16" id="cStatus">

    From then you can access any attribute of the image. For instance to get the value of the title:

    document.getElementById('cStatus').title;

    This way you can get/change the value of an attribute.

  4. #4
    Join Date
    Dec 2012
    Posts
    6
    Thanks guys , works fine now

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles