SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast inderpal.singh's Avatar
    Join Date
    Jul 2006
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Read Tag Attribute Value

    Hi All,

    Is it possible to read the value of attribute inside <LI> tag. I have defined my own attribute there.

    Code:
    <LI id="firstitem" remove="yes"> 
    <LI id="seconditem" remove="no">
    I have to read the remove attribute and its value and then have to do some functioning on that. If its not possible, can anyone tell me some alternative way. I would appreciate if somebody please help in this regard.

    Best Regards,
    Inderpal Singh

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Instead of using invalid markup, why not use a class?
    HTML Code:
    <li id="firstitem" class="remove">
    <li id="seconditem">
    Then just check the class attribute (e.g., through the .className property) to see if it contains 'remove'.
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Enthusiast inderpal.singh's Avatar
    Join Date
    Jul 2006
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I read the attribute using getAttribute() method and it's working fine. Let me know if there are any issues associated wiith it.

    Regards,
    Inderpal Singh


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
  •