SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need Help Findin Position Of List Item In Unordered List

    Hi,

    I have a unordered list that looks like this...
    HTML Code:
    <ul id="list">
       <li id="item-1">
          <h2>News Header 1</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
       <li id="item-2">
          <h2>News Header 2</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
       <li id="item-3">
          <h2>News Header 3</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
       <li id="item-4">
          <h2>News Header 4</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
       <li id="item-5">
          <h2>News Header 5</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
       <li id="item-6">
          <h2>News Header 6</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
       <li id="item-7">
          <h2>News Header 7</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
       <li id="item-8">
          <h2>News Header 8</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
       <li id="item-9">
          <h2>News Header 9</h2>
          <p>Some interesting information about some part of this (or another) website.</p>
       </li>
    </ul>
    Its formatted to look like this:


    These can be sorted on the fly with Ajax, however I also want to use a mechanism for turning on/off any one of the 'rows'. See below:


    I intend to do this using Ajax aswell, I want to get the ids of the 1-3 li's, 4-6 li's and 7-9 li's, and then pass them to the database and set the active field to on/off . My problem is that I cant figure out how to actually get the ids of the list items in each 'row' because it changes whenever the user changes the sort order of the list items.

    Can anyone help? Feel free to ask questions.
    Thanks.

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You could keep each box constant (and thus the id too) and just move the contents of the boxes (using cloneNode) from box to box, instead of moving the entire box. It might make moving them about a little more challenging, but deleting rows will be easy.


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
  •