Results 1 to 3 of 3

Thread: eliminating the id value of a variable.

  1. #1
    Join Date
    Sep 2008
    Posts
    119
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Question eliminating the id value of a variable.

    Ok, so let's say I have an array of 3 id values of li elements.

    <ul id="main">
    <li id="one"></li>
    <li id="two"></li>
    <li id="three"></li>
    </ul>

    No, you can get the array of these three a few different ways, but my question is, how do I eliminate the id value of one? What I have experienced when I set document.getElementById("two").id = '', is that in the lookup of the array of ids, this occurs - "one,,three" - which leave an annoying two comma problem. Any input on this?

    - Ben
    document.write is document.wrong

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Try

    Code:
    document.getElementById("two").removeAttribute("id");

  3. The Following User Says Thank You to codeexploiter For This Useful Post:

    Falkon303 (03-27-2009)

  4. #3
    Join Date
    Sep 2008
    Posts
    119
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by codeexploiter View Post
    Try

    Code:
    document.getElementById("two").removeAttribute("id");
    Awesome. Thank you much.
    document.write is document.wrong

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
  •